I am getting experiencing a similar problem to this question:
UnsatisfiedLinkError with sqlite4java Jar on Mac OS X
However, I am running on a Mac, and I have the relevant libraries in my lib folder. However, if I run this as is I get the UnsatisfiedLinkError. If I run "java -jar sqlite4java.jar -d" I get the following output:
sqlite4java 282
130321:222850.424 FINE [sqlite] Internal: loading library
130321:222850.425 FINE [sqlite] Internal: java.library.path=/Users/mikey/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.
130321:222850.425 FINE [sqlite] Internal: sqlite4java.library.path=null
130321:222850.425 FINE [sqlite] Internal: cwd=/Users/mikey/NetBeansProjects/Test/lib/.
130321:222850.425 FINE [sqlite] Internal: default path=/Users/mikey/NetBeansProjects/Test/lib
130321:222850.425 FINE [sqlite] Internal: forced path=null
130321:222850.426 FINE [sqlite] Internal: os.name=mac os x; os=osx
130321:222850.426 FINE [sqlite] Internal: os.arch=x86_64
130321:222850.426 FINE [sqlite] Internal: trying to load sqlite4java-osx-x86_64
130321:222850.427 FINE [sqlite] Internal: cannot load sqlite4java-osx-x86_64: java.lang.UnsatisfiedLinkError: no sqlite4java-osx-x86_64 in java.library.path
130321:222850.427 FINE [sqlite] Internal: trying to load sqlite4java-osx-amd64
130321:222850.428 FINE [sqlite] Internal: cannot load sqlite4java-osx-amd64: java.lang.UnsatisfiedLinkError: no sqlite4java-osx-amd64 in java.library.path
130321:222850.428 FINE [sqlite] Internal: trying to load sqlite4java-osx-10.4
130321:222850.431 INFO [sqlite] Internal: loaded sqlite4java-osx-10.4 from system path
130321:222850.433 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
I can see that it is looking for the sqlite4java-osx-x86_64 library, so I then ran both "ln -s libsqlite4java-osx.jnilib libsqlite4java-osx-x86_64.jnilib" and "ln -s libsqlite4java-osx-10.4.jnilib libsqlite4java-osx-x86_64.jnilib" and that seems to help:
sqlite4java 282
130321:223211.473 FINE [sqlite] Internal: loading library
130321:223211.474 FINE [sqlite] Internal: java.library.path=/Users/mikey/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.
130321:223211.474 FINE [sqlite] Internal: sqlite4java.library.path=null
130321:223211.474 FINE [sqlite] Internal: cwd=/Users/mikey/NetBeansProjects/Test/lib/.
130321:223211.474 FINE [sqlite] Internal: default path=/Users/mikey/NetBeansProjects/Test/lib
130321:223211.474 FINE [sqlite] Internal: forced path=null
130321:223211.475 FINE [sqlite] Internal: os.name=mac os x; os=osx
130321:223211.475 FINE [sqlite] Internal: os.arch=x86_64
130321:223211.475 FINE [sqlite] Internal: trying to load sqlite4java-osx-x86_64
130321:223211.477 INFO [sqlite] Internal: loaded sqlite4java-osx-x86_64 from system path
130321:223211.479 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_MEMORY_MANAGEMENT ENABLE_RTREE OMIT_DEPRECATED TEMP_STORE=1 THREADSAFE=1
Seems fine, right? No. When I try and run my java code, it fails yet again when trying to open the database with the UnsatisfiedLinkError.
Is there something obvious I am missing? Here is an ls of the relevant part my lib directory just as a sanity check:
-rw-r--r--@ 1 mikey staff 466792 1 Mar 2012 libsqlite4java-android-armv7.so
-rw-r--r--@ 1 mikey staff 790986 1 Mar 2012 libsqlite4java-linux-amd64.so
-rw-r--r--@ 1 mikey staff 732637 1 Mar 2012 libsqlite4java-linux-i386.so
-rw-r--r--@ 1 mikey staff 1400368 1 Mar 2012 libsqlite4java-osx-10.4.jnilib
-rw-r--r--@ 1 mikey staff 1401592 1 Mar 2012 libsqlite4java-osx-ppc.jnilib
lrwxr-xr-x 1 mikey staff 25 21 Mar 22:31 libsqlite4java-osx-x86_64.jnilib -> libsqlite4java-osx.jnilib
-rw-r--r--@ 1 mikey staff 1433640 1 Mar 2012 libsqlite4java-osx.jnilib
-rw-r--r-- 1 mikey staff 928 17 Mar 17:05 nblibraries.properties
drwxr-xr-x 3 mikey staff 102 15 Mar 18:59 sqlite4java
drwxr-xr-x 13 mikey staff 442 19 Mar 17:49 sqlite4java-282 2
-rw-r--r--@ 1 mikey staff 102236 1 Mar 2012 sqlite4java-docs.zip
-rw-r--r--@ 1 mikey staff 100502 1 Mar 2012 sqlite4java-src.zip
-rw-r--r--@ 1 mikey staff 622080 1 Mar 2012 sqlite4java-win32-x64.dll
-rw-r--r--@ 1 mikey staff 462848 1 Mar 2012 sqlite4java-win32-x86.dll
-rw-r--r--@ 1 mikey staff 129381 1 Mar 2012 sqlite4java.jar
And a copy of my database connection code:
import com.almworks.sqlite4java.SQLiteConnection;
import com.almworks.sqlite4java.SQLiteException;
import java.io.File;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* Wrapper for Sqlite
*
* @author mikey
*/
public class Database {
private SQLiteConnection db;
public Database() {
db = new SQLiteConnection(new File("./test.db"));
try {
db.open(true);
} catch (SQLiteException ex) {
Logger.getLogger(Database.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
Thanks for any light you can shed on my problem...
EDIT
In response to @sereda here is the output from putting "com.almworks.sqlite4java.SQLite.main(new String[] {"-d"});" into the database connection code:
sqlite4java 282
130322:161109.097 FINE [sqlite] Internal: loading library
130322:161109.099 FINE [sqlite] Internal: java.library.path=/Users/mikey/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.
130322:161109.100 FINE [sqlite] Internal: sqlite4java.library.path=null
130322:161109.100 FINE [sqlite] Internal: cwd=/Users/mikey/NetBeansProjects/Test/.
130322:161109.101 FINE [sqlite] Internal: default path=/Users/mikey/NetBeansProjects/Test/lib
130322:161109.101 FINE [sqlite] Internal: forced path=null
130322:161109.102 FINE [sqlite] Internal: os.name=mac os x; os=osx
130322:161109.102 FINE [sqlite] Internal: os.arch=x86_64
130322:161109.105 FINE [sqlite] Internal: trying to load sqlite4java-osx-x86_64
130322:161109.108 FINE [sqlite] Internal: cannot load sqlite4java-osx-x86_64: java.lang.UnsatisfiedLinkError: no sqlite4java-osx-x86_64 in java.library.path
130322:161109.108 FINE [sqlite] Internal: trying to load sqlite4java-osx-amd64
130322:161109.112 FINE [sqlite] Internal: cannot load sqlite4java-osx-amd64: java.lang.UnsatisfiedLinkError: no sqlite4java-osx-amd64 in java.library.path
130322:161109.112 FINE [sqlite] Internal: trying to load sqlite4java-osx-10.4
130322:161109.115 FINE [sqlite] Internal: cannot load sqlite4java-osx-10.4: java.lang.UnsatisfiedLinkError: no sqlite4java-osx-10.4 in java.library.path
130322:161109.115 FINE [sqlite] Internal: trying to load sqlite4java-osx
130322:161109.118 FINE [sqlite] Internal: cannot load sqlite4java-osx: java.lang.UnsatisfiedLinkError: no sqlite4java-osx in java.library.path
130322:161109.119 FINE [sqlite] Internal: trying to load sqlite4java
130322:161109.122 FINE [sqlite] Internal: cannot load sqlite4java: java.lang.UnsatisfiedLinkError: no sqlite4java in java.library.path
130322:161109.123 FINE [sqlite] Internal: trying to load sqlite4java-osx-x86_64-d
130322:161109.127 FINE [sqlite] Internal: cannot load sqlite4java-osx-x86_64-d: java.lang.UnsatisfiedLinkError: no sqlite4java-osx-x86_64-d in java.library.path
130322:161109.127 FINE [sqlite] Internal: trying to load sqlite4java-osx-amd64-d
130322:161109.131 FINE [sqlite] Internal: cannot load sqlite4java-osx-amd64-d: java.lang.UnsatisfiedLinkError: no sqlite4java-osx-amd64-d in java.library.path
130322:161109.131 FINE [sqlite] Internal: trying to load sqlite4java-osx-10.4-d
130322:161109.134 FINE [sqlite] Internal: cannot load sqlite4java-osx-10.4-d: java.lang.UnsatisfiedLinkError: no sqlite4java-osx-10.4-d in java.library.path
130322:161109.134 FINE [sqlite] Internal: trying to load sqlite4java-osx-d
130322:161109.137 FINE [sqlite] Internal: cannot load sqlite4java-osx-d: java.lang.UnsatisfiedLinkError: no sqlite4java-osx-d in java.library.path
130322:161109.138 FINE [sqlite] Internal: trying to load sqlite4java-d
130322:161109.141 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-x86_64 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)
at frakdeck.Database.<init>(Database.java:19)
at frakdeck.Test.start(Test.java:22)
at com.sun.javafx.application.LauncherImpl$5.run(LauncherImpl.java:319)
at com.sun.javafx.application.PlatformImpl$5.run(PlatformImpl.java:215)
at com.sun.javafx.application.PlatformImpl$4$1.run(PlatformImpl.java:179)
at com.sun.javafx.application.PlatformImpl$4$1.run(PlatformImpl.java:176)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl$4.run(PlatformImpl.java:176)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:76)
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.