Question

We are creating a runnable java jar to run on a beagle bone black(running ubuntu).

We have created a runnable jar which runs fine on our mac and pc(windows) but will not run on the ubuntu system. We keep getting the following error when running:

    Exception in thread "main" java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
    Caused by: java.lang.UnsatisfiedLinkError: /home/ubuntu/.jssc/linux/libjSSC-2.6_armhf.so: /home/ubuntu/.jssc/linux/libjSSC-2.6_armhf.so: cannot open shared object file: No such file or directory
        at java.lang.ClassLoader$NativeLibrary.load(Native Method)
        at java.lang.ClassLoader.loadLibrary1(ClassLoader.java:1965)
        at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1890)
        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1851)
        at java.lang.Runtime.load0(Runtime.java:795)
        at java.lang.System.load(System.java:1062)
        at jssc.SerialNativeInterface.<clinit>(SerialNativeInterface.java:172)
        at jssc.SerialPort.<init>(SerialPort.java:118)
        at InputBoard.<init>(InputBoard.java:33)
        at InputBoard.main(InputBoard.java:22)
        ... 5 more

Any information would be greatly appreciated. As I said this runs fine through terminal on a mac which is unix based so it seems it should work on Ubuntu. We have no idea why it is referencing the /home/ubuntu directory. Please let us know if you need any code information on the project but I would not think it would be related.

Was it helpful?

Solution 2

I fixed this problem when I installed the latest JDK 8 for Hard float for Arm. Previously I tried several things, I tried using versions 2.6, 2.7 and 2.8, specified LD_LIBRARY_PATH env. variable, making sure that library was in ~/.jssc/linux, etc, etc all this to no avail, only after I upgraded java, it worked flawlessly.

OTHER TIPS

You are missing a native runtime library. You can install this library by using apt-get to fetch the package it contains. To do this, give this command.

sudo apt-get install libc6-*

I had this same error even with the latest version. In my case it turned out to be that JSSC was trying to use the "soft float" version of the native libraries that it copies out of the .jar file. I ended up replacing the file with the hard float version from the .jar file and removing write access to the file. Everything started working after that.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top