We recently had a number of users having problems running PDFsam Basic on latest Ubuntu, this is the typical stacktrace they get back when trying to run the application:

Exception in thread “main” java.lang.NoClassDefFoundError: javafx/scene/layout/HBox
at java.base/java.lang.ClassLoader.defineClass1(Native Method)
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1009)
at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:801)
at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:699)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:622)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:580)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:190)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:499)
at org.pdfsam.community.App.main(App.java:34)
Caused by: java.lang.ClassNotFoundException: javafx.scene.layout.HBox
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:190)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:499)

PDFsam Basic requires Java 8 with JavaFX. On Ubuntu you can install the Java runtime environment provided by Oracle which ships with JavaFX, or you can install the openjdk 8 (provides Java) and openjfx 8 (provides JavaFX) from the official repository. There is no openjfx package matching java 9 and 10 in the official Ubuntu repository and this is causing the error. You have an upgraded Java version (9 or 10) but there is no matching JavaFX.

Current solution

The current solution is to downgrade your default Java to version 8.

  • Make sure you install openjdk 8 and openjfx 8 from the repository
  • If the issue is still there, make sure the openjdk 8 is the default java using the command sudo update-alternatives --config java

Long term solution

We are working on a PDFsam Basic version that runs on openjdk 11 and its matching openjfx 11 package.

Additional discussions


Leave a Reply

Your email address will not be published. Required fields are marked *