1

I'm trying to make a cross-platform JavaFX application, and it works fine on Windows and OSX machines, but not on Linux.

When I try to run it on a Linux machine using java -jar app.jar, this is what I get:

Error: Could not find or load main class app.Main

But the class app.Main is in the .jar, as shown by 'jar tf app.jar':

...
app/Main.class
...

I tried specifying the main class using java -cp app.jar app.Main but I got the same error message.

The .jar was built in Intellij IDEA, using basic JavaFX configuration.

Any help?

Matheus Valin
  • 161
  • 1
  • 8
  • 2
    Which Java runtime do you have on the linux machine? OpenJDK does not ship with JavaFX. – James_D Mar 27 '17 at 20:06
  • 3
    [Which linux?](https://www.cyberciti.biz/faq/find-linux-distribution-name-version-number/), what Java version ([`java -version`])? Related: [Why is JavaFX is not included in OpenJDK 8 on Ubuntu Wily (15.10)?](http://stackoverflow.com/questions/34243982/why-is-javafx-is-not-included-in-openjdk-8-on-ubuntu-wily-15-10) and [JavaFX and OpenJDK](http://stackoverflow.com/questions/18547362/javafx-and-openjdk). See also [Oracle java distributions for Linux](http://www.oracle.com/technetwork/java/javase/downloads/index.html), which include JavaFX. – jewelsea Mar 27 '17 at 21:00

1 Answers1

1

So, turns out the problem was that the JRE on the Linux machine was OpenJDK, which does not come with JavaFX, as noted by James_D and jewelsea

After installing the oracle JRE 8, it worked fine

Matheus Valin
  • 161
  • 1
  • 8