centos rpm installation jdk1.8

1, the official website to download the jdk rpm file ( http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html )

2, to execute the command file directory

rpm -ivh jdk-8u221-linux-x64.rpm

3, the default installation directory under /usr/java/jdk1.8.0_221-amd64

4, configure the environment variables:

cd /etc/profile

End of the text add the following configuration:

JAVA_HOME=/usr/java/jdk1.8.0_221-amd64
CLASSPATH=%JAVA_HOME%/lib:%JAVA_HOME%/jre/lib
PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin
export PATH CLASSPATH JAVA_HOME

5, reload profile

source /etc/profile

6, checks for success

java -version

Guess you like

Origin www.cnblogs.com/sung1024/p/12198181.html