下載jdk-8u71-linux-x64.tar.gz 創建jvm文件夾(/usr/lib/jvm) sudo mkdir /usr/lib/jvm 創建jvm文件夾(/usr/lib/jvm) sudo tar zxvf jdk-8u71-linux-x64.tar.gz -C /usr/lib/
-
下載jdk-8u71-linux-x64.tar.gz
-
創建jvm文件夾(/usr/lib/jvm)
sudo mkdir /usr/lib/jvm
-
創建jvm文件夾(/usr/lib/jvm)
sudo tar zxvf jdk-8u71-linux-x64.tar.gz -C /usr/lib/jvm
-
設置環境變數(全局)
sudo gedit /etc/profile
打開profile文件輸入
export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_71 export CLASSPATH=".:$JAVA_HOME/lib:$CLASSPATH" export PATH="$JAVA_HOME/bin:$PATH"
-
設置系統預設JDK
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.8.0_71/bin/java 300 sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.8.0_71/bin/javac 300 sudo update-alternatives --config java
-
驗證JDK
java -version