1

Good day, I am trying to run a program called graphdb-native-app-8.8.1-jfx.jar on a ubuntu virtual machine. I have the latest version of java installed, and have made sure JAVA_HOME is set to the correct java-version.

java -version
java version "11.0.2" 2019-01-15 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.2+9-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.2+9-LTS, mixed mode)

I have also used sudo apt-get install openjfx to get JavaFX (and also for libopenjfx-java), and made sure it is the newest version by searching for updates:

sudo apt list --installed| grep jfx
libopenjfx-java/bionic,now 8u161-b12-1ubuntu2 all [installed] 
libopenjfx-jni/bionic,now 8u161-b12-1ubuntu2 amd64 [installed]
openjfx/bionic,now 8u161-b12-1ubuntu2 amd64 [installed]

Yet whenever I try to run the jar, I get the following error:

sudo /usr/lib/jvm/java-11-openjdk-amd64/bin/java -jar ./graphdb-native-app-8.8.1-jfx.jar
Error: Could not find or load main class com.ontotext.graphdb.free.GraphDBFree
Caused by: java.lang.NoClassDefFoundError: javafx/application/Application

which leads to believe that the linux VM doesn't find javafx anyways or thinks it isn't installed.

I have scoured stackoverflow for similar questions, but most of them are solved by installing openjfx like I did. Others commence with their own .java files they want to compile and run with jfx and are solved by following the guides in https://openjfx.io/openjfx-docs/#install-javafx

Any help would be thoroughly appreciated, thanks in advance

  • If `graphdb-native-app-8.8.1-jfx.jar` is designed to run on 8, you need Java 8 and install JavaFX 8 for it (if you use OpenJDK 8 for instance), as suggested in the answer below. If you use Java 11, you need JavaFX 11, and you can install it as explained in the link you have posted, but then you'll need to run with `module-path` and `add-module` arguments in the command line (see at the end of the referred link). – José Pereda Mar 14 '19 at 14:06

2 Answers2

2

it seams that your java version is 11 and javafx for java 8 try to install the java 8 version and then maybe try again.

mdsfksf
  • 36
  • 1
  • It's a combination of this answer and some more stuff. The JAVA_HOME environment variable needs to be set to java 8 as well and CHMOD is necessary as well to allow reading the file. so on the file use 'chmod u=rwx' and then execute using java 8. The same goes if someone is having trouble for GRAPHDB standalone server. The 'graphdb.bat' startup script needs to be modified using chmod before using it with java 8 installed. Thanks everyone! – Andrew Malcolm Mar 21 '19 at 15:36
1

The openjfx package contains the javafx libraries for Java 8 in Ubuntu 18.04. Only from Ubuntu 18.10 the package contains the libraries for Java 11. (see https://packages.ubuntu.com/search?keywords=openjfx)

If your application can run with Java 8 downgrade your Java version and your problem should be solved.

If you need to run your app with Java 11 you can follow the guide you linked to install JavaFX for Java 11:

  1. Download JavaFX here
  2. Extract the Jars to a directory of your choice (e.g. /opt/javafx-sdk-11.0.2/)
  3. Run your jar with --module-path and --add-modules option to specify the JavaFX location:

    java -jar --module-path /opt/javafx-sdk-11.0.2/lib --add-modules=javafx.controls,javafx.fxml graphdb-native-app-8.8.1-jfx.jar
    

The last option would be to upgrade your whole system to Ubuntu 18.10. But I would not recommend that for only that reason.

Samuel Philipp
  • 10,631
  • 12
  • 36
  • 56