Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does not load JDBC Library on ARM by execute Java Application

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 can't 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.

like image 947
user3623194 Avatar asked Jan 20 '26 01:01

user3623194


2 Answers

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.

like image 72
remipod Avatar answered Jan 21 '26 15:01

remipod


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

like image 41
Angel O'Sphere Avatar answered Jan 21 '26 16:01

Angel O'Sphere



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!