CentOS6.5 install jdk

CentOS6.5 install jdk

download jdk1.7

Create a new folder /usr/local/java/jdk

mkdir -p /usr/local/java/jdk

Use the command to download jdk1.7

cd /usr/local/java/jdk

wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/7u71-b14/jdk-7u71-linux-x64.tar.gz

-- jdk 1.8 download address is: 

wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u111-b14/jdk-8u111-linux-x64.tar.gz

Extract to current folder

tar -zxvf jdk...(jdk file name)


Configure environment variables

vim /etc/profile // Press the letter i to enter the editing state, press Esc after editing, enter: wq to save.

// add at the bottom 

JAVA_HOME=/usr/local/java/jdk/jdk1.7...(jdk文件夹名称)
PATH=$JAVA_HOME/bin:$PATH  CLASSPATH=$JAVA_HOME/jre/lib/ext:$JAVA_HOME/lib/tools.jar
export PATH JAVA_HOME CLASSPATH

After the configuration is complete, restart the global variable and execute the following command:

source /etc/profile 

Verify that the configuration is successful?

java -version

If you see the jdk version information, the configuration is successful.


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325990506&siteId=291194637