PX4-Autopilot: A java problem with make posix jmavsim in Ubuntu

Hello everybody, I hit a snag with jmavsim SITL simulation on ubuntu but I tried to strictly follow instructions. I run Ubuntu 18.04 (Bionic), gazebo 9 and ROS Melodic. Firmware and submodules are up to date.

My problem is that make posix jmavsim results in an error as shown below.

BUILD SUCCESSFUL Total time: 0 seconds Exception in thread “main” java.lang.NoClassDefFoundError: javax/vecmath/Tuple3d at java.base/java.lang.Class.forName0(Native Method) at java.base/java.lang.Class.forName(Class.java:374) at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:56) Caused by: java.lang.ClassNotFoundException: javax.vecmath.Tuple3d at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:466) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:566) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:499) … 3 more Exception in thread “main” java.lang.NoClassDefFoundError: javax/vecmath/Tuple3d at java.base/java.lang.Class.forName0(Native Method) at java.base/java.lang.Class.forName(Class.java:374) at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:56) Caused by: java.lang.ClassNotFoundException: javax.vecmath.Tuple3d at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:466) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:566) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:499) … 3 more

I believe this is not a new issue, as it appeared to be almost identical to #9311, with the exception that I use ubuntu. My Java version is

openjdk version “10.0.1” 2018-04-17 OpenJDK Runtime Environment (build 10.0.1+10-Ubuntu-3ubuntu1) OpenJDK 64-Bit Server VM (build 10.0.1+10-Ubuntu-3ubuntu1, mixed mode)

Per @julianoes 's suggestion, switching to Java 8 (either java-8-openjdk-amd64 or java-8-oracle) and redoing the build resulted in the following:

BUILD SUCCESSFUL Total time: 1 second Exception in thread “main” java.lang.UnsupportedClassVersionError: me/drton/jmavsim/Simulator has been compiled by a more recent version of the Java Runtime (class file version 54.0), this version of the Java Runtime only recognizes class file versions up to 52.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:763) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:467) at java.net.URLClassLoader.access$100(URLClassLoader.java:73) at java.net.URLClassLoader$1.run(URLClassLoader.java:368) at java.net.URLClassLoader$1.run(URLClassLoader.java:362) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:361) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:348) at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:56) Exception in thread “main” java.lang.UnsupportedClassVersionError: me/drton/jmavsim/Simulator has been compiled by a more recent version of the Java Runtime (class file version 54.0), this version of the Java Runtime only recognizes class file versions up to 52.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:763) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:467) at java.net.URLClassLoader.access$100(URLClassLoader.java:73) at java.net.URLClassLoader$1.run(URLClassLoader.java:368) at java.net.URLClassLoader$1.run(URLClassLoader.java:362) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:361) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:348) at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:56)

Strangely enough, gazebo setup is largely successful and I am able to simulate in both SITL and HITL. Nevertheless I could really use jmavsim as a lighter, faster simulator since I am only concerned with multirotors. Thank you for looking into this issue!

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 22 (13 by maintainers)

Most upvoted comments

I just ran into this again. Oracle Java is not needed, OpenJDK 8 is fine. However, this workaround is needed:

sudo gedit /etc/java-8-openjdk/accessibility.properties

and comment out the following line like this:

#assistive_technologies=org.GNOME.Acessibility.AtkWrapper

Fix found here: https://askubuntu.com/questions/695560