But you can download the production-ready OpenJDK 12 from here and install it as shown. Unfortunately, RHEL 8 does not provide or support Java 12 by default. The output of the above command shows that Java 8 is the default version. Once the installation process is complete, you can check the Java version installed using the following command. # dnf install java-11-openjdk-devel #install JDK 11 # dnf install java-1.8.0-openjdk-devel #install JDK 8 Next, install OpenJDK 8 and 11 using the following commands. To install OpenJDK on RHEL 8, first update the system packages using dnf command as shown. RHEL 8 with RedHat Subscription Enabled.We will also show you how to install the latest version of Java OpenJDK 12 to develop and run Java applications. In this article, we will show you how to install OpenJDK 8 and OpenJDK 11, the two supported versions of Java in RHEL 8. Note: If you are looking for free JDK versions, install the Oracle OpenJDK which offers the same features and performance as Oracle JDK under the GPL license. It is Oracle’s supported Java SE ( Standard Edition) version. On the other hand, if you want to develop applications for Java, you need to install the Oracle Java Development Kit ( JDK) which includes a complete JRE together with tools for developing, debugging and monitoring Java applications. You typically need the Java Runtime Environment ( JRE), a bundle of software components used to run Java applications. To run Java-based applications on your RHEL 8 system or server, you need to have Java installed. Java is more than just a language, it is a technology platform with many interconnected capabilities. Save changes and close file.Java is a fast, secure, reliable, and popular, general-purpose programming language and computing platform. Write the path by simply skipping “bin/java”: JAVA_HOME="/usr/lib/jvm/java-11-openjdk-amd64/" Set the JAVA_HOME environment variable with the value of binary path from the previous command. So, to avoid any errors it is suggested to set the JAVA_HOME variable.įirst, find the java binary path with the following command: sudo update-alternatives -list javaĪfter that, to set the variable edit the /etc/environment file in any text editor: sudo nano /etc/environment Many Java-based applications use the JAVA_HOME environment variable to get the location of Java saved on your PC. If you also have JDK installed, do the same for “javac”: sudo update-alternatives -config javacĮnter a number to set the required version as default. You have successfully updated the default JRE version. You can choose the Java version which is associated with a number, type number, and press Enter. You will get a list of installed Java versions on your system where each version is associated with a number, and any version can be set as the default Java environment of your system. You can have multiple versions of Java on your system, they can easily be managed by using the command: sudo update-alternatives -config java Step 2 – Switching Between Multiple Java Versions Once the download and installation is done, you can check the version: java -version You can also have installed both versions on your system. Install Latest Java (OpenJDK 17) on Debian 11 – Use the following command to install the current latest version OpenJDK 17, execute the following command: sudo apt install openjdk-17-jre openjdk-17-jdk.
You can ignore JDK or JRE package based on your requirements.