1. 在/usr/local目錄下創建java安裝目錄java
# mkdir /usr/local/javalinux
# cd /usr/local/java/vim
2.將jdk安裝報拷貝到java目錄下ui
# mv ./ jdk-8u60-linux-x64.tar.gz /usr/local/javaspa
3.解壓jdk到當前目錄io
# tar -zxvf jdk-8u60-linux-x64.tar.gz變量
獲得文件夾 jdk1.8.0_60jdk
4.編輯配置文件,配置環境變量配置
# vim /etc/profilefile
添加以下內容:JAVA_HOME根據實際目錄來
export JAVA_HOME=/usr/local/java/jdk1.8.0_60
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib:$CLASSPATH
export JAVA_PATH=${JAVA_HOME}/bin:${JRE_HOME}/bin
export PATH=$PATH:${JAVA_PATH}
# source /etc/profile
6.查看安裝狀況
# java -version
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) Client VM (build 25.60-b23, mixed mode)