UnsatisfiedLinkError with sqlite4java Jar on Mac OS X NetBeans

谁说胖子不能爱 提交于 2019-11-28 12:32:58

This is the solution of :

Exception in thread "main" com.almworks.sqlite4java.SQLiteException:
[-91]cannot load library: java.lang.UnsatisfiedLinkError: no sqlite4java-osx-x86_64
in java.library.path

Please try running this:

 java -jar sqlite4java.jar -d

to make it try to load all variants of the binary and verify the results.

the result must be like this:

java -jar sqlite4java.jar -d
sqlite4java 282
121212:134119.239 FINE [sqlite] Internal: loading library
121212:134119.239 FINE [sqlite] Internal:java.library.path=/Users/XXXXX/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.
121212:134119.240 FINE [sqlite] Internal: sqlite4java.library.path=null
121212:134119.240 FINE [sqlite] Internal: cwd=XXXXX
121212:134119.240 FINE [sqlite] Internal: default path=XXXXX
121212:134119.240 FINE [sqlite] Internal: forced path=null 
121212:134119.240 FINE [sqlite] Internal: os.name=mac os x; os=osx
121212:134119.240 FINE [sqlite] Internal: os.arch=x86_64
121212:134119.240 FINE [sqlite] Internal: trying to load sqlite4java-osx-x86_64
121212:134119.243 FINE [sqlite] Internal: cannot load sqlite4java-osx-x86_64: java.lang.UnsatisfiedLinkError: no sqlite4java-osx-x86_64 in java.library.path
121212:134119.243 FINE [sqlite] Internal: trying to load sqlite4java-osx-amd64
121212:134119.244 FINE [sqlite] Internal: cannot load sqlite4java-osx-amd64:         java.lang.UnsatisfiedLinkError: no sqlite4java-osx-amd64 in java.library.path
121212:134119.244 FINE [sqlite] Internal: trying to load sqlite4java-osx-10.4
121212:134119.249 INFO [sqlite] Internal: loaded sqlite4java-osx-10.4 from system path
121212:134119.252 INFO [sqlite] Internal: loaded sqlite 3.7.10, wrapper 0.2
SQLite 3.7.10
Compile-time options: ENABLE_COLUMN_METADATA ENABLE_FTS3 ENABLE_FTS3_PARENTHESIS     ENABLE_LOCKING_STYLE=0 ENABLE_MEMORY_MANAGEMENT ENABLE_RTREE OMIT_DEPRECATED TEMP_STORE=1    THREADSAFE=1

The files are tried in the order of more specific to less specific. So the order is correct.

The problem is that there's no more specific binary -so we might need to rename libsqlite4java-osx.jnilib to libsqlite4java-osx-amd64.dylib.

I had the same error for my program after upgrade to Mountain Lion. When I added the libraries to /Libraries/Java/Extensions he program run fine. I don't know if this the best solution, but it worked.

Not sure what exactly is the problem, but you can try running sqlite4java's diagnostics code from within your program and see if it shows the same loading sequence:

public Database() {
    com.almworks.sqlite4java.SQLite.main(new String[] {"-d"});
    db = new SQLiteConnection(new File("./test.db"));
    ...

I had the same problem, but managed to get it to load sqlite by creating the libs folder from the IDE and then copying the jar into the new libs folder. Then I removed the old version of the jar from the build path and added in the new one. Hope this helps!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!