1

after I have installed openjdk-11.jdk and openjfx I was able to get openjfx ip and running within Eclipse following this thread: How to add JavaFX runtime to Eclipse in Java 11?

But all my attempts to let it run in the command line failed (I have added the path to the openfx as well: /usr/share/openjfx/lib). Within the bin folder /test-fx/bin I call java application.Main and I receive java.lang.NoClassDefFoundError: javafx/application/Application Conclusion: Java does find Main.main(), but cannot find the JavaFX Application class. test-fx is just my Eclipse folder. the structure is like this:

test-fx
    src
        application
            Main.java
    bin
        application
            Main.class

And this is Main.java:

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

    @Override
    public void start() {
        ...
    }
}

Does anybody know a good solution on that? What is recommended? How should I define PATH, where should it point to?

Alex-2017a
  • 11
  • 2
  • You should give your command line. – Olivier Mar 08 '20 at 19:31
  • I have updated my thread above. – Alex-2017a Mar 09 '20 at 08:40
  • What is test-fx? Is that the output from using jlink? Also, when you call `java` is that the system java you're calling? – matt Mar 09 '20 at 08:43
  • I have updated my thread above. – Alex-2017a Mar 09 '20 at 09:53
  • You haven't added the javafx libraries when you try to run the code. You're just using the system java. You should be able to use. `java --module-path $PATH_TO_FX --add-modules=javafx.controls -cp . application.Main` example from here. https://github.com/openjfx/samples/tree/master/CommandLine/Non-modular/CLI note that $PATH_TO_FX is the path to your fx libraries. – matt Mar 09 '20 at 10:03
  • Thank you, that works! To everybody else reading this thread: Do not change the general PATH. Neither JAVA_HOME nor JAVAFX_HOME is required. – Alex-2017a Mar 09 '20 at 11:20

0 Answers0