centos 7 installation JDK1.8

Reference website: https://www.jianshu.com/p/2835654ebfac

Download the installation package, ftp server transmitted, decompressed

cd /usr/local && mkdir java
cp /root/jdk-8u161-linux-x64.tar.gz ./java
cd java/
tar -zxvf jdk-8u161-linux-x64.tar.gz
rm -rf jdk-8u161-linux-x64.tar.gz

Editing environment variable configuration file: vim / etc / profile
added at the end the following (the JAVA_HOME installed jdk path) in the file

export JAVA_HOME=/usr/local/jdk1.8.0_161
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$JAVA_HOME/bin:$PATH

Vim by the: wq command to save and exit
to validate the configuration: source / etc / profile

jdk verification
executed java -version command, as shown in FIG see representatives successful installation.

 

 

Mounting two
downloaded here rpm package, jdk-8u191-linux-x64.rpm

Installation steps
to clean up the system by default comes with jdk, execute the following command
rpm -qa | grep jdk # view already comes with the JDK
sudo yum the Remove XXX # if you uninstall command, (XXX found as a result of the command)
to give permission : sudo chmod 777 jdk-8u191- linux-x64.rpm
Note: to modify permissions because they do not know the specific use when you download account and use the account, it gives direct read and write, and execute permissions.
Installation: rpm -ivh jdk-8u191-linux -x64.rpm
default installation path: / usr / java, such as: /usr/java/jdk1.8.0_191
configure the environment variables and verification jdk supra

Guess you like

Origin www.cnblogs.com/marszhw/p/12010210.html