1.下載官方jdk http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.htmlhtml
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.解壓java
tar -zxvf jdk-8u161-linux-x64.tar.gz
3. 設置環境變量linux
vi /etc/profile
將下面這段shell放在最後, JAVA_HOME修改成本身的jdk目錄shell
# 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
保存並退出oracle
4. 使修改過的profile文件生效code
source /etc/profile