Java.lang.UnsatisfiedLinkError: org.sqlite.core.nativeDB.open ()

I created a Java application that uses SQLite (sqlite-jdbc-3.8.7.jar) and flipped everything into a jar file. Running the jar file on windows works as expected, however trying to run it on Ubuntu Server 14.04 has become quite a daunting task! I put together a new VM in VirtualBox for testing. I installed Java (sudo apt-get install default-jre) and tried to install SQLite both from the repositories and by downloading tar and compiling. SQLite only installs exactly both ways as I can access it from terminal. I created a new subdirectory in my home directory and copied it into the application jar file. From the terminal, I run the command: sudo java -jar.jar and I get java.lang.unsatisfiedlinkerror. Check the attached image for more to do,to make this work on Ubuntu? Any help would be appreciated!

enter image description here

+2


source to share


4 answers


I have a similar problem and will return to sqlite-jdbc-3.7.2 working for me (Ubuntu 14.04 32bits)



+5


source


Well, I had similar problems and had to go back to the sqlite-jdbc-3.7.2.jar package because the driver in the newer package didn't work for some reason under 64 bit Linux on my (dreamhost so called vps ). The new package had no problems on Windows 8.1 x64. I also had to move the tmp dir to home (System.setProperty ("java.io.tmpdir", "/ home / username /");).



+2


source


Sqlite writes its own lib to tmpdir and tries to use it. If dmp tmp is on the filesystem installed by noexec it will crash and may display an error like what you see.

One way to avoid this is to install java tmpdir as other answers have pointed out. Another is to remove noexec from tmp fs.

To check:

$ mount | grep /tmp
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noexec,noatime,size=6291456k)

      

To change this, edit / etc / fstab, remove noexec from the / tmp line, then reboot.

(Note that noexec is considered a security feature as it prevents rogue applications from trying to do exactly what sqlite does here.)

0


source


Add this to your code and see if there are any problems with your tmpdir ...

     final File tmp = new File(System.getProperty("java.io.tmpdir")); 
 if (!tmp.exists() || !tmp.isDirectory() || !tmp.canRead() || !tmp.canWrite()){
     System.err.println("@PFTcreateDB - Issue with java.io.tmpdir");
 }

      

This could indicate a lack of tmp or incorrect privileges.

0


source







All Articles