标签:inux get 令行 set edit version 保存 sudo span
tar -zxvf jdk-8u101-linux-x64.tar.gz
cd /usr/lib
sudo mkdir java
sudo mv jdk1.8.0_101/ /usr/lib/java
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/java/jdk1.8.0_101/bin/java" 1
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/java/jdk1.8.0_101/bin/javac" 1
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/java/jdk1.8.0_101/bin/javaws" 1
sudo gedit ~/.bashrc
在文件最最后加上3行后保存即可
#JAVA HOME directory setup
export JAVA_HOME=/usr/lib/java/jdk1.8.0_101
export PATH="$PATH:$JAVA_HOME/bin"
最后在命令行输入 java -version 测试安装成功!
标签:inux get 令行 set edit version 保存 sudo span
原文地址:http://www.cnblogs.com/woshiai/p/7092456.html