2

I created a project in eclipse and want to run my exported .jar file on an other machine. When I try to do so using "java -jar myfile.jar", I get the following message: Error: JavaFX runtime components are missing, and are required to run this application

If I run it in eclipse (using jdk13), everything works.

On the machine where I want to run the jar file I installed openjdk and openjfx. Actually I'm not sure wether the problem has to be solved in eclipse while exporting the jar file or on the other machine while running it? And how? May anyone give me a hint?

user4402088
  • 57
  • 1
  • 6
  • 2
    The error you're seeing is typically caused by having your main class extend `javafx.application.Application` but the application is launched with JavaFX on the classpath. The `java -jar ...` command uses the classpath. The fix is to create a separate main class that simply launches JavaFX (e.g. by invoking `Application.launch(YourApp.class, args)`). – Slaw Jun 23 '20 at 09:14
  • 1
    Note if that doesn't help then you should [edit] your question to provide a [mre] demonstrating the problem. – Slaw Jun 23 '20 at 09:23
  • @Slaw could you kindly give an example of how to create a separate main class as you have stated? I am using IntelliJ, and I'm having the same problem trying to export the default JavaFX code. – Kochez Jan 30 '22 at 10:46
  • @Kochez Added example to [your gist](https://gist.github.com/RyanKoech/15e2dd446f5424c2fe86249e5528289d). – Slaw Jan 30 '22 at 21:07

0 Answers0