2

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.

Travis Elliott
  • 291
  • 2
  • 5
  • 18
  • Have you run any other Java apps on the beagle bone? Something either in your app, or the Java JVM is trying to load the jssc library. Perhaps a workaround would be to [install jssc](http://code.google.com/p/java-simple-serial-connector/wiki/jSSC_Start_Working) and see if that gets past this error (not sure if the Linux installs they have are compatible with this Ubuntu version). – Sam Goldberg Feb 28 '14 at 16:00
  • Thanks @Sam, We have ran other java applications on the beagle bone no problem. Most of these Serial Port libraries for Java require native plugins like dll for windows. I put those in the Native Libraries in the Eclipse project and exported the jar but I am getting an unsatisfied link error now for java.system.path Any ideas? – Travis Elliott Mar 05 '14 at 16:17
  • If you are talking about running from shell (command line), make sure you have set _LD_LIBRARY_PATH_ e.g.: `export LD_LIBRARY_PATH=/directory_where_so_file_is`. Also, Java has a System Property called `java.library.path` which you can also set using `-Djava.library.path=...`. See this [SO post](http://stackoverflow.com/questions/661320/how-to-add-native-library-to-java-library-path-with-eclipse-launch-instead-of) for doing it if running inside Eclipse. Note that ths `.so` file shown in your error has a specific version, so make sure you have correct version of so file. HTH. – Sam Goldberg Mar 06 '14 at 19:19

3 Answers3

1

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-*
O. Jones
  • 103,626
  • 17
  • 118
  • 172
Alvins
  • 867
  • 16
  • 27
0

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.

0

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.

Gregg Harrington
  • 123
  • 1
  • 11