设置JAVA_HOME在Android SDK中 [英] Setting JAVA_HOME at Android SDK

查看:668
本文介绍了设置JAVA_HOME在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:

  1. 点击开始,右键点击电脑并选择属性(可以 同时按住Windows键和preSS暂停/ Break键)。
  2. 点击左侧高级系统设置。
  3. 单击底部的环境变量按钮。
  4. 点击系统变量窗口下方的New ...按钮。
  5. 输入以下内容:

  1. Click Start, right click on Computer and select properties (you can also hold down the windows key and press the pause/break key).
  2. Click on Advanced system settings on the left.
  3. Click the Environment Variables button on the bottom.
  4. Click the New... button below the System variables window.
  5. Enter the following:

    Variable name: JAVA_HOME
    Variable value: C:\jdk1.6.0_23\ 

  • 单击确定,确定,确定,并关闭系统控制面板在第1步
  • 打开
  • 关闭并重新打开命令提示符窗口。
  • Click Ok, Ok, Ok, and close the system control panel you opened in step 1
  • Close and re-open your command prompt.
  • 如果您使用的是Eclipse然后跳过上述步骤并执行以下操作:

    If you are using Eclipse then skip the steps above and do the following:

    1. 单击窗口菜单上选择preferences。
    2. 展开左侧的蚂蚁项,然后单击运行
    3. 单击在右侧的Classpath选项卡全球条目。
    4. 单击添加外部JAR ...
    5. 在导航到C:\ jdk1.6.0_23 \ lib和选择的tools.jar依次打开
    6. 点击确定关闭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屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆