0

So, My operating system is Ubuntu 18.04, and I have downloaded Netbeans 11.0. I have also installed openjdk-11, and openjfx-11, so these are all to be found on my computer. My problem is, when I want to make a javafx project I click on File>New Project>Categories>JavaFxApplication and I create my project. Netbeans creates all the files I need, and the basic (boiler plate) code, but when I look at the code I see that all the lines which have anything to do with javafx are underlined red. When I try to build my project it throws an error saying An unknown compilation problem occurred. I don't know what to do, I thought of manually adding the javafx jar file, but I don't know where I could find it, and it's also considerably not the most professional way of handling such an error. Could someone help me please? :(

1 Answers1

0

JavaFX is not included in the Java 11 JDK. You have to include it as a separate library.

Run dpkg-query -L openjfx-11 to figure out where OpenJFX was installed, then add it as a library in Netbeans: Projects -> (your project) -> Properties -> Libraries -> Add Jar/Folder

cbryant02
  • 583
  • 4
  • 16
  • Thanks, but it says that there is package with the name openjfx-11 is not installed, but when I try to install it, it says `openjfx is already the newest version (11.0.2+1-1~18.04.2)`. And there is no `Libreries` under the `Properties` menu – H. Roberto May 23 '19 at 19:32
  • The package name is just `openjfx` then. Run the same command, but replace `openjfx-11` with `openjfx`. – cbryant02 May 23 '19 at 19:34
  • Now I'm using eclipse instead of Netbeans, I added the packages, yet it still displays this error message 'Error: Could not find or load main class application.Main Caused by: java.lang.NoClassDefFoundError: javafx/application/Application' – H. Roberto May 30 '19 at 19:11