Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UnsatisfiedLinkError with sqlite4java, no sqlite4java-osx-amd64

Tags:

java

sqlite

I am having a similar issue to this problem:

UnsatisfiedLinkError with sqlite4java Jar on Mac OS X NetBeans

I am running a script that uses sqlite, and while I am able to successfully run sqlite3 through the command line, I always get this error when I try to run the script:

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

When I run "java -jar sqlite4java.jar -d" in my lib folder, I see this:

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)

Does anyone have any ideas as to what I am missing?

like image 471
lbrendanl Avatar asked Apr 29 '14 00:04

lbrendanl


1 Answers

Your java.library.path does not include the current directory.

The default on my OSX box is:

/Users/MY_USERNAME/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.

But yours reads

/Users/MY_USERNAME/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java

Note the :. at the end of the first line.

You should be able to get it to work by either running

java -Djava.library.path=. -jar sqlite4java.jar

Or by copying *.jnilib files from sqlite4java-282.zip into any directory in java.library.path (e.g. /Users/lee33/Library/Java/Extensions)

Or by adjusting the path for the project in an IDE of your choice:

  • How to set the java.library.path from Eclipse
  • giving 'java.library.path' in netbeans for .dll/.so files

See also:

  • Default Java library path?
like image 61
anttix Avatar answered Nov 14 '22 20:11

anttix