<Android development> Android development tools - of - java installation / switching version
1. Installation
Install JDK6: sudo apt-get install openjdk-6-jdk
Install JDK7: sudo apt-get install openjdk-7-jdk
Install JDK8: sudo apt-get install openjdk-8-jdk
Install ubuntu default version:sudo apt-get install default-jdk
2. Modify environment variables and
use vi to open "~/.bashrc"
export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_162 #//此位置是对应版本安装的路径
export JRE_HOME=${
JAVA_HOME}/jre
export CLASSPATH=.:${
JAVA_HOME}/lib:${
JRE_HOME}/lib
export PATH=${
JAVA_HOME}/bin:$PATH
3. Switch version
Switch java
input command: sudo update-alternatives --config java
select the number of the corresponding version
Switch javac
input command: sudo update-alternatives --config javac
select the number of the corresponding version
4. Check the version number
java -version
javac -version