この質問と同様の問題が発生しています。
Mac OS X での sqlite4java Jar での UnsatisfiedLinkError
ただし、私は Mac で実行しており、lib フォルダーに関連するライブラリがあります。ただし、これをそのまま実行すると、UnsatisfiedLinkError が発生します。「java -jar sqlite4java.jar -d」を実行すると、次の出力が得られます。
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
sqlite4java-osx-x86_64 ライブラリを探していることがわかるので、「ln -s libsqlite4java-osx.jnilib libsqlite4java-osx-x86_64.jnilib」と「ln -s libsqlite4java-osx-10.4.jnilib」の両方を実行しました。 libsqlite4java-osx-x86_64.jnilib" とそれが役立つようです:
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
いいですね。いいえ。Java コードを実行しようとすると、UnsatisfiedLinkError でデータベースを開こうとすると、再び失敗します。
私が見逃している明らかなものはありますか?これは、健全性チェックとして、私の lib ディレクトリの関連部分の ls です。
-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
そして、私のデータベース接続コードのコピー:
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);
}
}
}
あなたが私の問題に当てることができる光をありがとう...
編集
@sereda への応答として、"com.almworks.sqlite4java.SQLite.main(new String[] {"-d"});" を配置した場合の出力を次に示します。データベース接続コードに:
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)