使用sqlite4java的UnsatisfiedLinkError,没有sqlite4java
我遇到了类似的问题:
在Mac OS X NetBeans上使用sqlite4java Jar的UnsatisfiedLinkError
我正在运行一个使用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中调整项目的路径:
也可以看看:
上一篇: UnsatisfiedLinkError with sqlite4java, no sqlite4java
下一篇: Extract file name from path, no matter what the os/path format