12

I am a beginner in JavaFX and trying to run JavaFX in Eclipse on Ubuntu.

I have openjfx installed on my pc, but it is giving the error

JavaFX runtime components are missing, and are required to run this application.

I have searched a lot but not got any solution.

enter image description here

user1803551
  • 12,965
  • 5
  • 47
  • 74

2 Answers2

5

Try simply creating a launcher.
For your App, it should look something like this:

package application;

import javafx.application.Application;

public class MainLaunch {

    public static void main(final String[] args) {
        Application.launch(Main.class, args);
    }
}

(you can leave the old main Method unused in your App for the time-being)
This worked for me with JDK 13 & JavaFX 13 & Eclipse 2019-12 under Ubuntu.
(I created the Project using "new/Maven Project/Simple Project" and then just added JavaFX, Logging & other stuff as dependencies in pom.xml, which all landed on the Classpath. Only the JDK was on the Modulepath)
No need to bother about Java Modules.

If that works, you can take time to learn about Java Modularisation another day...

Patrick Mevzek
  • 10,995
  • 16
  • 38
  • 54
Dave The Dane
  • 650
  • 1
  • 7
  • 18
0

The suggestion from Venkata Raju brought me already half the way with Eclipse (2019-03 with Java 11):

VM argumments: -> Provide this value --module-path /<path>/javafx-sdk-11/lib/ --add-modules=javafx.controls

In addition, I made sure to uncheck "Use the -XstartOnFirstThread argument when launching with SWT" option in the same panel of the launch configuration.