0

Have been trying to set up JavaFX with Eclipse on Ubuntu. The code doesn't have an issue importing the javafx classes anymore (this took a LONG time to get working), but when running some simple test code, Eclipse can't seem to find the main class even when I right click on the file directly and run as Java Application.

package mainpackage;

import javafx.application.Application;
import javafx.stage.Stage;

public class Main extends Application {

    @Override
    public void start(Stage primaryStage) throws Exception {
        primaryStage.setTitle("Window");

        primaryStage.show();
    }   

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

}



Error: Could not find or load main class mainpackage.Main
Caused by: java.lang.NoClassDefFoundError: javafx/application/Application

  • That all depends how exactly you setup your project. Before going for combining javafx and eclipse, have you tried to follow an eclipse tutorial, to get a simple hello world running? – GhostCat Sep 13 '19 at 11:36
  • this could probably help you [link](https://stackoverflow.com/questions/16868446/javafx-exception-in-thread-main-java-lang-noclassdeffounderror-javafx-applica) – poisn Sep 13 '19 at 11:42

0 Answers0