首页 > 代码库 > Android Automotive开发之一《环境: JDK7&JDK8切换 》

Android Automotive开发之一《环境: JDK7&JDK8切换 》

http://ubuntuhandbook.org/index.php/2015/01/install-openjdk-8-ubuntu-14-04-12-04-lts/

 

安装OpenJDK8

sudo add-apt-repository ppa:openjdk-r/ppasudo apt-get update sudo apt-get install openjdk-8-jdk

 

切换方法

sudo update-alternatives --config javasudo update-alternatives --config javac

 

如果是下载的安装包,不是apt-get install,可以这样配置

1. 配置环境变量,在文件etc/profile中添加:set java environmentexport JAVA_HOME=/usr/local/jdk1.8.0_91  export JRE_HOME=${JAVA_HOME}/jre  export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib  export PATH=${JAVA_HOME}/bin:$PATH2. 安装sudo update-alternatives --install /usr/bin/java java /usr/local/jdk1.8.0_91/bin/java 300 sudo update-alternatives --install /usr/bin/javac javac /usr/local/jdk1.8.0_91/bin/javac 300 

 

也可以remove

sudo update-alternatives --remove java /usr/local/jdk1.8.0_91/bin/javasudo update-alternatives --remove javac /usr/local/jdk1.8.0_91/bin/javac 

 

Android Automotive开发之一《环境: JDK7&JDK8切换 》