Ubuntu – Problems setting up Java on Ubuntu 19.10

19.10javajavafxopenjdk

I'm new to all of this, so I ask for your comprehension.

A couple of days ago I installed Ubuntu 19.10 on my PC and I'm having trouble setting up Java. At the beginning, I just used the sudo apt-get approach and it all seem fine, but then I realized that the project that I had to work on used JavaFX and this wasn't included in the original installation. After that, I searched through out the web for a comprehensive setup guide, but many sites have different answers and I got overwhelmed by the amount of information that, honestly, did not understand by the most part.

I've uninstalled all and now I have to different zip files:

  • A JDK 14.0.1 Linux Build, found on this site
  • A JavaFX 14.0.1 zip file, found on this site

I'm really stressed out by the whole ordeal, so if anybody could guide me through the installation process, or had a resourceful site that could explain what to do step-by-step I'd be eternally grateful.

Best Answer

openjfx and openjdk-14-jdk are available for install through APT. To install them run the following command in the terminal:

sudo apt install openjdk-14-jdk openjfx

Then set openjdk-14-jdk as default by runnibg the following command in the terminal:

sudo update-alternatives --config java

You will see an output like this:

  Selection    Path                                            Priority   Status
------------------------------------------------------------
  0            /usr/lib/jvm/java-14-openjdk-amd64/bin/java      1411      auto mode
  1            /usr/lib/jvm/java-11-openjdk-amd64/bin/java      1111      manual mode
  2            /usr/lib/jvm/java-14-openjdk-amd64/bin/java      1411      manual mode
* 3            /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java   1081      manual mode

Press <enter> to keep the current choice[*], or type selection number: 

Please, enter the number in front of java-14-openjdk under Selection column and press Enter

Related Question