Reputation: 1959
I'm unable to run jar files of JavaFX applications on my Ubuntu virtual machine and I don't know why. It just says that it can't find the main file of the jar. Other jars of for example Swing applications seem to work fine. This is what I get when I run java -version
on Ubuntu:
It seems like it has Java 8 where JavaFX should be included by default, so why can't I run the jars?
Edit: The jar consists of one class that looks like this:
import javafx.application.Application;
import javafx.stage.Stage;
public class Main extends Application {
public static void main(String[] args) {launch(args);}
public void start(Stage ps) {
ps.show();
}
}
And it was created with the command jar cfe javafxjar.jar Main Main.class
The jar executes without problems on Windows 10, but fails with this message on Ubuntu:
Upvotes: 4
Views: 6267
Reputation: 357
Today I've also bumped into this problem.
In my case the reason was OpenJDK. It does not contain OpenJFX by default.
The solution was: sudo apt-get install openjfx
And now all works like a charm.
Upvotes: 1
Reputation: 230
Could it be due to the JAVA_TOOL_OPTIONS:
$ unset JAVA_TOOL_OPTIONS
$ java -jar javafxjar.jar
Upvotes: 0