I'm trying to run a .jar file made in Eclipse using JDK 11 on a raspberry pi 4. For the Raspbian OS I had to use a 64-bit version instead of a 32 bit.

I put the jar into a folder together with the native files to get it to run as per this link, but it doesn't seem to work.

I ran java -version in raspbian to check the version of java, and it is using 11.0.8 The project seems to run alright in Eclipse, but doesn't run on my raspberry pi. When I run the jar from the raspbian terminal, it returns the error:

Failed to load library: /boot/arcade_test/libjinput-linux64.so: /boot/arcade_test/libjinput.64.so: cannot open shared object file: No such file or directory (Possible cause: can't load AMD 64-bit .so on a AARCH64-bit platform)

I don't think I'm missing the actual library. The terminal called the error a java.lang.UnsatisfiedLinkError. I used the following line to hardcode where my program should look for the library.

System.setProperty("net.java.games.input.librarypath", new File("/boot/arcade_test").getAbsolutePath());

Does anyone know what exactly is happening and how I can fix it?

Edit 1:

Here's the link to where I found the .img file for the raspbian os that I'm using

  • It would appear that @goldilocks answered this question a few years ago here – Nick Aug 30 '20 at 18:26
  • sudo apt-get install libjinput-java libjinput-java-doc libjinput-jni – Dougie Aug 30 '20 at 22:03
  • @Dougie that just seems to lead to the same error as before – HelloThere Aug 31 '20 at 4:30
  • See also: stackoverflow.com/q/37545912/1151724 – goldilocks Sep 6 '20 at 13:17

Does anyone know what exactly is happening...

The "No such file or directory" bit is probably misleading -- it is more likely the second reason, "can't load AMD 64-bit .so on a AARCH64-bit platform". The AMD64, aka. x86-64, architecture (your normal computer running Eclipse) is not compatible with AARCH64 (the Pi).

While java byte code is portable it often depends on precompiled native libraries that it may be linked specifically to (hence "unsatisfied link" error).

...and how I can fix it?

You'll have to compile the code on the Pi.

  • Thanks, that was also my guess. When you said compiling code on the pi, what did you mean by that? Like downloading an IDE on the Pi and coding from there? – HelloThere Aug 30 '20 at 15:13
  • No, I mean like with a java compiler, which is what the IDE uses, but you don't need an IDE (or a GUI) to use it: javac. You'll need to install the JDK (on Raspbian/Debian/Ubuntu etc systems apt install openjdk-11-jdf-headless should get you started). Note that openjdk and the Oracle distribution (not sure they even have one for the Pi anymore) are pretty much the same at this point, I think. There should be oodles of tutorials about using the compiler. It is pretty simple depending on the scale of what you are up to. – goldilocks Aug 30 '20 at 15:35
  • This is really getting somewhere. I originally imported an external jar following this tutorial to function as a library for JInput. Could I do something similar without using eclipse (for some reason, I can't install eclipse). – HelloThere Aug 31 '20 at 5:07
  • JInput is in the Raspbian (and probably every other linux distro) repository (apt search jinput). WRT using it w/o eclipse (which methinks will never usefully run on a Pi even if you can install it, it is just too resource intensive), this is what the compiler classpath is for -- you really need to learn this stuff at some point, and the longer you wait the more of a hassle it will be for you. – goldilocks Aug 31 '20 at 14:41
  • ...This includes learning the fundamentals of java build systems, the predominant one being maven -- I notice the jinput github repo uses a pom.xml build config, == maven. The other one you will see a lot w/ java is build.xml, which is ant and somewhat older. These integrate easily w/ eclipse, meaning you can use it to configure a build and then just maven on the Pi to automate it (since most projects involve more than just a single javac invocation, sourcing dependencies, etc). – goldilocks Aug 31 '20 at 14:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.