Different Android versions of the recommended JDK may be different, which leads to the work in multiple different Android versions will need different versions of jdkAndroidL and the latest Google recommended is openjdk-7-jdk, only JDK 7 and later versions are allowed. However, in versions 4.4 and earlier, JDK 7 fails to be compiled, and many projects fail to be compiled, in addition to fixing compilation failure, we can also install JDK 6. First we download the sun-jdk-6 out, install a little, I put the file
JDK recommended for different Android versions may be different. As a result, jdk of different versions is required for multiple Android versions.
Android L and the latest Google recommended openjdk-7-jdk, and restrictions can only use JDK 7 or later versions, but in versions 4.4 and below, JDK 7 Compilation failed, many project compilation failed, in addition to fixing compilation failure, we can also install JDK 6.
First, we download the sun-jdk-6, install a little, I release the file to the/opt/jdk directory
The configuration is as follows:
$ Sudo vim/etc/profile
Add the following content at the end of the file to save and close the file.
# for java
export JAVA_HOME=/opt/jdk
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=$PATH:${JAVA_HOME}/bin:${JRE_HOME}/bin
$ Source/etc/profile
* If you do not have a multi-version jdk, you can write the last line like this./opt/jdk will be used directly without switching.
PATH =$ {JAVA_HOME}/bin :$ {JRE_HOME}/bin: $ PATH
* If you have multiple jdks, you can write them in one line./usr/bin/java->/etc/alternatives/java
Export PATH = $ PATH :$ {JAVA_HOME}/bin :$ {JRE_HOME}/bin
Then execute the following
$ Sudo update-alternatives-install/usr/bin/javah/opt/jdk/bin/javah 255
$ Sudo update-alternatives-install/usr/bin/javac/opt/jdk/bin/javac 255
$ Sudo update-alternatives-install/usr/bin/java/opt/jdk/bin/java 255
$ Sudo update-alternatives-install/usr/bin/jar/opt/jdk/bin/jar 255
After installing sun jdk, We will install openjdk (install Ubuntu 14.04)
$ Sudo apt-get install openjdk-7-jdk
After the installation is complete, run the following command to switch your jdk
$ Sudo update-alternatives-config java
$ Sudo update-alternatives-config javac
$ Sudo update-alternatives-config javah
$ Sudo update-alternatives-config jar
Of course, you can set different jdk switches in the build when compiling different android versions.
Install JDK 7 (with Clojure download) http://www.linuxidc.com/Linux/2012-10/71557.htm under Ubuntu
Install JDK1.7 http://www.linuxidc.com/Linux/2012-06/62239.htm in Ubuntu 12.04
CentOS6.3 install JDK and environment configuration http://www.linuxidc.com/Linux/2012-09/70780.htm
For more information about Ubuntu, see Ubuntu special page http://www.linuxidc.com/topicnews.aspx? Tid = 2
This article permanently updates the link address: Http://www.linuxidc.com/Linux/2014-07/104087.htm