Ubuntu 22.04 NoClassDefFoundError

starting 3.6.6 using the VASSAL.sh gives:

Exception: java.lang.NoClassDefFoundError thrown from the UncaughtExceptionHandler in thread "main"

installed is:
/usr/lib/jvm/java-11-openjdk-amd64/bin/java

update: found an deb java on oracle site.
after installing and adding to the alternatives. VASSAL started.
please don’t use oracle proprietary instructions.

Glad you got it working. I would recommend using the openjdk-17-jre package, instead, though (17 is the latest Long Term Support version of Java), although VASSAL should still be backwards compatible with version 11.

1 Like

When this happens, there are two common causes:

  • You’re not running the version of Java you think you are. (You can check that with java --version.) You’ll have this problem if you have Java 8 as the one on your PATH.
  • You’re running a headless Java, i.e., on that has no graphics support.

In both cases, you need to be running the right Java. We recommend using a current OpenJDK build, for which Ubuntu will have a package you can install. We don’t recommend installing one from Oracle, ever.

thank you, but both things u mention are not the case.
as shown above i was running java 11. yes i checked it with java -version
no i am not running without graphic support (my own java program uses graphics and works fine)

the reason is a wrote later: an oracle proprietary class was used, which is not part of the openjdk 11. hence installing the oracle jdk and using alternative config to it solved the problem.
that’s why i said open jdk should be used if portability is a target.

I don’t believe so. Which class?

I’m running Kubuntu 22.04 with the above mentioned package (OpenJDK 17 JRE), and VASSAL works just fine for me, so there’s something else going on with your system.

hm. difference is jdk: i am on 11 (default installation of ubuntu 22.04). will try to get openjdk 17 and try again…

i don’t have to source code to debug which class. fact is it runs on oracle java 11 but not on openjdk,
cleaned log and retried with openjdk 11. stacktrace:
java.lang.UnsatisfiedLinkError: Can’t load library: /usr/lib/jvm/java-11-openjdk-amd64/lib/libawt_xawt.so

so checked the library:
kschindl@belgarathUbuntu:/usr/lib/jvm$ find . -name libawt_xawt.so -print
./jdk-11/lib/libawt_xawt.so
./java-8-openjdk-amd64/jre/lib/amd64/libawt_xawt.so

strange it is missing from openjdk 11.
so reinstalled complete openjdk 11.
and now it works.

@jrwatts : you were right. whenever openjdk on 21.10 was installed, something went wrong.
though i am using windowbuilder and gtk 3, never had a problem using awt…
the start script mentioning sun.java, led me on wrong path.

lesson learned: find the stacktrace…

This is because you had a headless install of OpenJDK 11, and the replacement one was not. libawt_xawt.so provides graphics capabilities, and is not present in a headless install.

I’ve removed --add-exports java.desktop/sun.java2d.cmm=ALL-UNNAMED from the startup script. That’s cruft which ought to have been removed as part of commit cd3f52c69 in 2020.

thank you for the explanation.i will also remove that part of the startup script.
just wonder why i never had an issue with my app, where i use lot’s of awt windows.
developed in eclipse using windowbuilder.

Eclipse was likely using a different JVM.

the jar always runs outside eclipse, and no the jre is not exported. it uses the linux jre.