您的位置:首页 > 移动开发 > Android开发

Android编译JAVA版本不对

2014-09-20 22:56 337 查看
编译时有时出现下面错误

************************************************************

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

或者直接运行上述命令
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: