设置JAVA_HOME在Android SDK中 [英] Setting JAVA_HOME at Android SDK
问题描述
我与 JAVA_HOME
配置一些冲突
当我用下面的code -
I have some conflicts with the JAVA_HOME
configuration
When I using the following code -
System.out.println(System.getenv("JAVA_HOME"));
我得到 - C:\ jdk1.6.0_23
这是正确的地方。
但是,当我在Android的build.xml运行Ant命令,我得到了以下错误消息 -
I get - C:\jdk1.6.0_23
which is the correct place.
But, When I run Ant command on an Android build.xml, I got the following error message -
C:\ Android的SDK-WINDOWS \工具\蚂蚁\ main_rules.xml:361:无法找到javac编译器; com.sun.tools.javac.Main不上 类路径。也许JAVA_HOME不 指向JDK。它当前设置 到C:\ jdk1.6.0_23 \ jre的
C:\android-sdk-windows\tools\ant\main_rules.xml:361: 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 "C:\jdk1.6.0_23\jre"
它如何能解决吗?
谢谢
的Eyal
推荐答案
要永久Windows中设置JAVA_HOME环境变量你所提到的JDK目录执行以下操作:
To permanently set your JAVA_HOME Environment Variable under Windows to the JDK directory you've mentioned do the following:
- 点击开始,右键点击电脑并选择属性(可以 同时按住Windows键和preSS暂停/ Break键)。
- 点击左侧高级系统设置。
- 单击底部的环境变量按钮。
- 点击系统变量窗口下方的New ...按钮。
-
输入以下内容:
- Click Start, right click on Computer and select properties (you can also hold down the windows key and press the pause/break key).
- Click on Advanced system settings on the left.
- Click the Environment Variables button on the bottom.
- Click the New... button below the System variables window.
Enter the following:
Variable name: JAVA_HOME
Variable value: C:\jdk1.6.0_23\
如果您使用的是Eclipse然后跳过上述步骤并执行以下操作:
If you are using Eclipse then skip the steps above and do the following:
- 单击窗口菜单上选择preferences。
- 展开左侧的蚂蚁项,然后单击运行
- 单击在右侧的Classpath选项卡全球条目。
- 单击添加外部JAR ...
- 在导航到C:\ jdk1.6.0_23 \ lib和选择的tools.jar依次打开 。
- 点击确定关闭preferences窗口。
在你的情况不过你最好的选择很可能是简单地追加C:\ jdk1.6.0_23 \ BIN使用我的第一个指令集,上面的大致参考你的PATH的环境变量
In your situation however your best bet would probably be to simply append C:\jdk1.6.0_23\bin to your PATH env var using my first set of instructions above as a rough guideline.
这篇关于设置JAVA_HOME在Android SDK中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!