JavaFX missing, Ubuntu 18.04

In the Ubuntu 16.04 and later default repositories JavaFX is packaged as a separate package named openjfx. To install it in Ubuntu 18.04, open the terminal and type:

sudo apt install openjdk-8-jdk openjfx

Check that JDK 8 is selected as the default Java version in Netbeans -> Tools -> Options -> Java -> Nashorn tab -> click the Manage Platforms button -> click the Add Platform button -> click the radio button marked Java Standard Edition -> click the Next button -> browse to /usr/lib/jvm/java-8-openjdk-amd64 and select it as the default Java version.

Optionally you can install openjdk-11-jdk instead of or alongside openjdk-8-jdk. openjfx works with both openjdk-8-jdk and openjdk-11-jdk in Netbeans in Ubuntu 18.04. I am using Netbeans 8.2 10.0 in Ubuntu 18.04.


I think the easiest way is to install sdkman. Once installed, check for all the available candidates:

$ sdk list java

which will show a wide variety of options. You may select one with the FX suffix. In my case I can see something like this:

 Azul ZuluFX   |     | 11.0.2       | zulufx  |            | 11.0.2-zulufx       
               |     | 8.0.202      | zulufx  |            | 8.0.202-zulufx      
 BellSoft      |     | 12.0.2       | librca  |            | 12.0.2-librca       
               |     | 11.0.4       | librca  |            | 11.0.4-librca       

So, you can install it using this command:

$ sdk install java 11.0.2-zulufx   

Or,

$ sdk install java 8.0.202-zulufx # if you want java 8

And you are good to go! I hope this helps! :)