问题
Ok We have a Java-application "app.jar" in a unix home directory with a external Sqlite Driver Library.
- myapp/app.jar
- myapp/lib/sqlite-jdbc-3.8.7.jar
Device Udoo ARM Cortex V9 simliar to Raspberry Pi.
java -version
java version "1.8.0_06
Java(TM) SE Runtime Environment (build 1.8.0_06-b23)
Java HotSpot(TM) Client VM (build 25.6-b23, mixed mode)
Try to run this application failed.
java -classpath lib/sqlite-jdbc-3.8.7.jar -jar myapp.jar
It seems that the Application cannot find the Library.
java.lang.Exception: No native library is found for os.name=Linux and os.arch=arm
at org.sqlite.SQLiteJDBCLoader.loadSQLiteNativeLibrary(SQLiteJDBCLoader.java:284)
at org.sqlite.SQLiteJDBCLoader.initialize(SQLiteJDBCLoader.java:65)
I cant find a solution until now. It is possible to copy the .jar File to the jdk/lib folder ?
Edit:
Now i tried to add the sqlite-jdbc-3.7.2.jar to the JRE and it works.
jdk1.8.0_06/jre/lib/ext
The newer version sqlite-jdbc-3.8.7.jar does not work.
回答1:
I compared the SQLiteJDBCLoader code in version 3.8.7 with version 3.7.2 and found some insight. 3.7.2 seems to have a pure java mode while the corresponding code is from 3.8.7 missing. From my little knowledge and a quick glance on the download page, I conclude one would need a native library for the target platform. I could not find a download for ARM.
If you need a pure java datebase, you might take another choice.
回答2:
I believe your command line is wrong. If you use -jar, then the -classpath is ignored!
Either the manifest in app.jar needs to refer to the library, or you need to start it like this: java -classpath lib/sqlite-jdbc-3.8.7.jar:myapp.jar name.of.MainClass
来源:https://stackoverflow.com/questions/26550598/does-not-load-jdbc-library-on-arm-by-execute-java-applikation