JDK offline installation and yum online installation and configuration under Linux

JDK offline installation, yum online installation and environment variable configuration under CentOS, taking JDK1.8 version as an example.

1. yum online installation

1. First search for resources in the yum library

yum search java | grep java-1.8

Insert image description here
2. Execute the installation command

yum -y install java-1.8.0-openjdk

After the installation is complete, the default installation path is:

 cd /usr/lib/jvm/

2. Configure environment variables

1. Edit the system configuration file

vim /etc/profile

2. Add at the end of the profile, JAVA_HOME below is the JDK folder

JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk
 
PATH=$JAVA_HOME/bin:$PATH
 
CLASSPATH=$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/jre/lib/ext
 
export PATH JAVA_HOME CLASSPATH

3. Install jdk offline

1. Download jdk-1.8.65
link: https://pan.baidu.com/s/1jeHae9blAjQsxlk2sGJEpA
extraction code: leov

2.Create a folder

mkdir /usr/rdc/java
cd /usr/rdc/java

And upload the downloaded installation file to this directory.

3. Unzip the installation package

tar -zxvf jdk-8u65-linux-x64.tar.gz

4. Configure environment variables.
See the previous article for details: 2. Configure environment variables.
The idea is that JAVA_HOME should be changed to: /usr/rdc/java/java1.8.65

Guess you like

Origin blog.csdn.net/hualinger/article/details/131481579