使用sqlite4java的UnsatisfiedLinkError,没有sqlite4java-osx-amd64

前端之家收集整理的这篇文章主要介绍了使用sqlite4java的UnsatisfiedLinkError,没有sqlite4java-osx-amd64前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我对这个问题有类似的问题:

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

或者将sqlite4java-282.zip中的* .jnilib文件复制到java.library.path中的任何目录中(例如/ Users / lee33 / Library / Java / Extensions)

或者通过在您选择的IDE中调整项目的路径:

> How to set the java.library.path from Eclipse
> giving ‘java.library.path’ in netbeans for .dll/.so files

也可以看看:

> Default Java library path?

猜你在找的Sqlite相关文章