我发现这个
Is Sun Java really necessary for using Android SDK on Ubuntu 10.10? I prefer OpenJDK但我无法在Ubuntu上构建android项目.当我尝试:
$ant debug
我有:
Unable to locate tools.jar. Expected to find it in /usr/lib/jvm/java-6-openjdk/lib/tools.jar ... BUILD Failed /home/kuba/projects/Android/android-sdk-linux/tools/ant/build.xml:651: The following error occurred while executing this line: /home/kuba/projects/Android/android-sdk-linux/tools/ant/build.xml:672: Unable to find a javac compiler; com.sun.tools.javac.Main is not on the classpath. Perhaps JAVA_HOME does not point to the JDK. It is currently set to "/usr/lib/jvm/java-6-openjdk/jre"
我有java版本:
$java -version java version "1.6.0_20" OpenJDK Runtime Environment (IcedTea6 1.9.13) (6b20-1.9.13-0ubuntu1~10.10.1) OpenJDK Client VM (build 19.0-b09,mixed mode,sharing)
确保安装了openjdk JDK.默认情况下,您可能只安装了JRE.如果您打开Synaptic,搜索openjdk然后您将看到JDK和JRE.选择JDK包并安装.我认为实际的包名是openjdk-6-jdk.
或使用命令行
# sudo apt-get install openjdk-6-jdk