我有与此问题类似的问题:
UnsatisfiedLinkError with sqlite4java Jar on Mac OS X NetBeans
我正在运行一个使用sqlite的脚本,尽管我能够通过命令行成功运行sqlite3,但是当我尝试运行该脚本时,总是会遇到此错误:
SEVERE: [sqlite] SQLiteQueue[master.catalog]: error running job queue
com.almworks.sqlite4java.SQLiteException: [-91] cannot load library: java.lang.UnsatisfiedLinkError: no sqlite4java-osx-amd64 in java.library.path
当我在我的lib文件夹中运行“java -jar sqlite4java.jar -d”时,我看到了:
140428:170139.831 FINE [sqlite] Internal: loading library
140428:170139.853 FINE [sqlite] Internal: java.library.path=/Users/lee33/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java
140428:170139.853 FINE [sqlite] Internal: sqlite4java.library.path=null
140428:170139.853 FINE [sqlite] Internal: cwd=/Users/lee33/Desktop/myria_workspace/myria/lib/sqlite4java-282/.
140428:170139.853 FINE [sqlite] Internal: default path=null
140428:170139.853 FINE [sqlite] Internal: forced path=null
140428:170139.854 FINE [sqlite] Internal: os.name=mac os x; os=osx
140428:170139.854 FINE [sqlite] Internal: os.arch=amd64
140428:170139.854 FINE [sqlite] Internal: trying to load sqlite4java-osx-amd64
140428:170139.855 FINE [sqlite] Internal: cannot load sqlite4java-osx-amd64: java.lang.UnsatisfiedLinkError: no sqlite4java-osx-amd64 in java.library.path
140428:170139.855 FINE [sqlite] Internal: trying to load sqlite4java-osx-10.4
140428:170139.856 FINE [sqlite] Internal: cannot load sqlite4java-osx-10.4: java.lang.UnsatisfiedLinkError: no sqlite4java-osx-10.4 in java.library.path
140428:170139.856 FINE [sqlite] Internal: trying to load sqlite4java-osx
140428:170139.857 FINE [sqlite] Internal: cannot load sqlite4java-osx: java.lang.UnsatisfiedLinkError: no sqlite4java-osx in java.library.path
140428:170139.857 FINE [sqlite] Internal: trying to load sqlite4java
140428:170139.858 FINE [sqlite] Internal: cannot load sqlite4java: java.lang.UnsatisfiedLinkError: no sqlite4java in java.library.path
140428:170139.858 FINE [sqlite] Internal: trying to load sqlite4java-osx-amd64-d
140428:170139.859 FINE [sqlite] Internal: cannot load sqlite4java-osx-amd64-d: java.lang.UnsatisfiedLinkError: no sqlite4java-osx-amd64-d in java.library.path
140428:170139.859 FINE [sqlite] Internal: trying to load sqlite4java-osx-10.4-d
140428:170139.859 FINE [sqlite] Internal: cannot load sqlite4java-osx-10.4-d: java.lang.UnsatisfiedLinkError: no sqlite4java-osx-10.4-d in java.library.path
140428:170139.860 FINE [sqlite] Internal: trying to load sqlite4java-osx-d
140428:170139.860 FINE [sqlite] Internal: cannot load sqlite4java-osx-d: java.lang.UnsatisfiedLinkError: no sqlite4java-osx-d in java.library.path
140428:170139.860 FINE [sqlite] Internal: trying to load sqlite4java-d
140428:170139.861 FINE [sqlite] Internal: cannot load sqlite4java-d: java.lang.UnsatisfiedLinkError: no sqlite4java-d in java.library.path
Error: cannot load SQLite
java.lang.UnsatisfiedLinkError: no sqlite4java-osx-amd64 in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1860)
at java.lang.Runtime.loadLibrary0(Runtime.java:845)
at java.lang.System.loadLibrary(System.java:1084)
at com.almworks.sqlite4java.Internal.tryLoadFromSystemPath(Internal.java:349)
at com.almworks.sqlite4java.Internal.loadLibraryX(Internal.java:124)
at com.almworks.sqlite4java.SQLite.main(SQLite.java:368)
有人对我缺少的东西有任何想法吗?
最佳答案
您的java.library.path
不包含当前目录。
我的OSX框上的默认值为:
/Users/MY_USERNAME/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.
但是你读
/Users/MY_USERNAME/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java
注意第一行末尾的
:.
。您应该可以通过以下两种方式使它正常工作
java -Djava.library.path=. -jar sqlite4java.jar
或者通过将
*.jnilib
文件从sqlite4java-282.zip
复制到java.library.path
中的任何目录中(例如/Users/lee33/Library/Java/Extensions
)或通过在您选择的IDE中调整项目的路径来进行:
也可以看看:
关于java - 带有sqlite4java的UnsatisfiedLinkError,没有sqlite4java-osx-amd64,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/23353291/