Android 在编译过程中需要用到Java Version 1.5的环境,然而系统中存在几个Java版本,针对Android要求编译的环境,通过一下命令可以修改当前编译和执行所需的Java版本。
1、修改java执行版本
# update-alternatives --config java
Selection Path Priority Status
------------------------------------------------------------
0 /usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 auto mode
* 1 /usr/lib/jvm/java-1.5.0-sun/jre/bin/java 53 manual mode
2 /usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 manual mode
# update-alternatives --config javac
There are 2 choices for the alternative javac (providing /usr/bin/javac).
Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/lib/jvm/java-6-openjdk/bin/javac 1061 auto mode
1 /usr/lib/jvm/java-1.5.0-sun/bin/javac 53 manual mode
2 /usr/lib/jvm/java-6-openjdk/bin/javac 1061 manual mode