Android编译JAVA版本不对

编译时有时出现下面错误

************************************************************ 
You are attempting to build with the incorrect version 
of java
. 
 
Your version is: WRONG_VERSION. 
The correct version is: RIGHT_VERSION. 
 
Please follow the machine setup instructions at 
    https
://source.android.com/source/download.html 
************************************************************ 

其实已经很清楚了,就是按照https://source.android.com/source/download.html 
写的做就行了。

首先看下自己的版本,命令

java -version

通常是1.5 (C->F), 1.6(G->KK), 1.7(L->)

假如需要版本是1.7,

$ sudo apt-get update 
$ sudo apt
-get install openjdk-7-jdk 
可能要做如下操作

$ sudo update-alternatives--config java 
$ sudo update
-alternatives --config javac 

操作完重启检查版本 java -version

如果不正确的话,可能是以前用过别的版本,

输入命令echo $JAVA_HOME,看看路径是否正确,不正确的话,改为正确的

可以修改/etc/profile,加上正确的版本, 例如

export JAVA_HOME=/usr/lib/jvm/java-6-oracle

或者直接运行上述命令

 

 

 

 

你可能感兴趣的:(Android编译)