Java JDK or Java Development Kit is an implementation of Java Platform. JDK includes a private Java Virtual Machine (JVM) and few other resources to facilitate the development of Java applications. JDK is an essential tool required by all Java based applications. Currently, it is the most widely used Software Development Kit (SDK).
In this article, we will install Java JDK 11 on CentOS 7 server from RPM and from tarball.
This Article Provides:
Installing Java JDK 11 from RPM on CentOS 7:
Connect to java-server.example.com using ssh as root user.
Download Java JDK 11 RPM for CentOS 7 from Oracle Technical Network (OTN) and copy it to the home directory of root user.
Install the downloaded package using rpm command.
# rpm -ivh jdk-11.0.1_linux-x64_bin.rpm
warning: jdk-11.0.1_linux-x64_bin.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:jdk-11.0.1-2000:11.0.1-ga ################################# [100%]
Set JAVA_HOME environment variable.
# echo "export JAVA_HOME=/usr/java/jdk-11.0.1" >> /etc/profile # export JAVA_HOME=/usr/java/jdk-11.0.1
Verify installation of Java JDK 11 by executing java command.
# java -version
java version "11.0.1" 2018-10-16 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.1+13-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.1+13-LTS, mixed mode)
Java JDK 11 has been installed from RPM Package on CentOS 7 server.
Installing Java JDK 11 from TAR on CentOS 7:
Connect to java-server.example.com using ssh as root user.
Download Java JDK 11 TAR for CentOS 7 from Oracle Technical Network (OTN) and copy it to the home directory of root user.
Extract downloaded tarball using tar command.
# mkdir /usr/java # tar xf jdk-11.0.1_linux-x64_bin.tar.gz -C /usr/java/ # ls /usr/java/ jdk-11.0.1
Set JAVA_HOME environment variable.
# echo "export JAVA_HOME=/usr/java/jdk-11.0.1" >> /etc/profile # export JAVA_HOME=/usr/java/jdk-11.0.1
Create the symbolic link for java using alternatives command.
# alternatives --install /usr/bin/java java /usr/java/jdk-11.0.1/bin/java 2 # alternatives --config java There is 1 program that provides 'java'. Selection Command ----------------------------------------------- *+ 1 /usr/java/jdk-11.0.1/bin/java Enter to keep the current selection[+], or type selection number:
We have only one JDK/JRE installed on this server, therefore, press <ENTER> to keep the current selection.
Create the symbolic link for javac using alternatives command.
# alternatives --install /usr/bin/javac javac /usr/java/jdk-11.0.1/bin/javac 2 # alternatives --config javac There is 1 program that provides 'javac'. Selection Command ----------------------------------------------- *+ 1 /usr/java/jdk-11.0.1/bin/javac Enter to keep the current selection[+], or type selection number:
Press <ENTER>.
Create the symbolic link for jar using alternatives command.
# alternatives --install /usr/bin/jar jar /usr/java/jdk-11.0.1/bin/jar 2 # alternatives --config jar There is 1 program that provides 'jar'. Selection Command ----------------------------------------------- *+ 1 /usr/java/jdk-11.0.1/bin/jar Enter to keep the current selection[+], or type selection number:
Press <ENTER>
Verify installation of Java JDK 11 by executing java command.
# java -version
java version "11.0.1" 2018-10-16 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.1+13-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.1+13-LTS, mixed mode)
Java JDK 11 has been installed from TAR on CentOS 7 server.
Read Also: How to Install Java 19 on Rocky Linux 9
No comments:
Post a Comment