linux install java jdk8

1. Download the official jdk   http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

wget http://124.205.69.170/files/31670000065F965E/download.oracle.com/otn-pub/java/jdk/8u161-b12/2f38c3b165be4555a1fa6e98c45e0808/jdk-8u161-linux-x64.tar.gz

2. Unzip

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

3. Set environment variables

vi /etc/profile

Put the following shell at the end, and change JAVA_HOME to your own jdk directory

# JAVA
JAVA_HOME=/usr/java/jdk1.8.0_151/
PATH=$JAVA_HOME/bin:$PATH
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export JAVA_HOME
export PATH
export CALSSPATH

save and exit

4. Make the modified profile file effective

source /etc/profile

 

Guess you like

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