Use Multiple Java Versions on Fedora Linux

Hello again, in this article I will show you how to install and use multiple Java versions on Fedora for different projects. Open the terminal and write:

dnf search openjdk

The output should be like this. These are available Java packages under DNF repositories. You can install what you want by command:

sudo dnf install [package-name]

In my case, I want to use java 8 and 11 development environments.

sudo dnf install java-1.8.0-openjdk-devel.x86_64sudo dnf install java-1.8.0-openjdk-devel.x86_64

To learn which java version is in use

java -version
current java version

You can switch to another java version with the command:

sudo alternatives --config java

It will list of installed java versions and you can swtich between them by writing selection number and hitting enter.

--

--