When the server OS installed on server or system, most of the time java version is not updated or not installed on operating system and also some time we need to update or upgrade java version on server. Earlier in our article we had install Java version 11 on fresh installed server . Now we are going to upgrade or update Java version from java version 11 ( openjdk 11 ) to Java version 13 ( openjdk 13.0.2 ) . Here you can see also the multiple version of java also installed on server. Recently Java version 14 also launched.
Below is my java version , I ran the command to check java version java -version, Now here is output of my command.
[[email protected]]# java --version openjdk 11 2018-09-25 OpenJDK Runtime Environment 18.9 (build 11+28) OpenJDK 64-Bit Server VM 18.9 (build 11+28, mixed mode)
Below are the steps to installed or upgrade java version .
Downloading Latest Java 13 Version
Here was java launch recently update openjdk 13.0.2 , so we have download on the server through below command . You can find latest version of java on official site page. Oracle also provides the latest OpenJDK release at jdk.java.net under the GPL License .
Run below command to download and extract the downloaded file .
Linux x64 Java Development Kit
# cd /tmp # wget https://download.java.net/java/GA/jdk13.0.2/d4173c853231432d94f001e99d882ca7/8/GPL/openjdk-13.0.2_linux-x64_bin.tar.gz # tar xvf openjdk-13.0.2_linux-x64_bin.tar.gz # mv jdk-11 /opt
As we have earlier discussed in other articles that –no-cookies and –header option with curl or wget because of oracle does not give download unless we have not accept their license or terms .for accept header and license use above syntax for download .
Installation of Java 13
Now go to the java extracted folder through below command and install or switch to java version through alternatives command. This is the best way to install or switch java version to other. When we run the alternatives –config java , the command output will show different java programs which provide java, We need to choose or select command.Here we have selected /opt/jdk-13.0.2/bin/java .Follow below command to set up.
# cd /opt/jdk-13.0.2 # alternatives --install /usr/bin/java java /opt/jdk-13.0.2/bin/java 2 # alternatives --config java
Now set the jar and javac path .
# alternatives --install /usr/bin/jar jar /opt/jdk-13.0.2/bin/jar 2 # alternatives --install /usr/bin/javac javac /opt/jdk-13.0.2/bin/javac 2 # alternatives --set jar /opt/jdk-13.0.2/bin/jar # alternatives --set javac /opt/jdk-13.0.2/bin/javac
Now set the Environment Variables path of Java,Jre home variable through below commands
# export JAVA_HOME=/opt/jdk-13.0.2/ # export JRE_HOME=/opt/jdk-13.0.2/jre
Check updated Java Version :
[[email protected]]# java --version openjdk 13.0.2 2020-01-14 OpenJDK Runtime Environment (build 13.0.2+8) OpenJDK 64-Bit Server VM (build 13.0.2+8, mixed mode, sharing)