" Android的创建和QUOT;调用失败在Windows 7 - 缺少JDK [英] "Android Create" call fails in windows 7 - missing JDK

查看:157
本文介绍了" Android的创建和QUOT;调用失败在Windows 7 - 缺少JDK的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个问题让我的Andr​​oid开发环境安装在Windows 7我按照说明这里,与几个环境sublinks。我使用的Eclipse的Andr​​oid插件。我已经安装了Java JDK好几次,在不同地点(JDK-6u20-窗口-i586.exe) - 但我显然失去了一些东西。

我每次运行的Android创建AVD --target 2 --name my_avd我得到一个错误:

  C:\用户\安德鲁>的Andr​​oid创建AVD --target 2 --name my_avd

警告:在Java的路径没有找到。
检查它它安装在C:\ Program Files文件\ Java的替代。


错误:没有找到合适的Java。为了正确使用Android开发者
工具,你需要在系统上安装一个合适的Java版本。我们
建议您安装JDK版本的JavaSE的,可在这里:
  http://java.sun.com/javase/downloads/

你可以在这里找到完整的Andr​​oid SDK中的要求:
  http://developer.android.com/sdk/requirements.html
 

此错误消息是我在安装JDK几次的原因。首先,我尝试安装到我的电子的位置:驱动器。然后我把它移到了默认禄(程序文件(x86)\ java的\ jdk.6.something。我也试图迫使其进入程序文件\路径,但它仍然会自动安装到(86)的路径。我添加安装路径,我的PATH环境变量每一次,但我还是继续得到这个错误。我怀疑是Windows 7和Android工具是不是在玩在一起很好地找到JDK的条款,但谁知道,它可能是完全不同的东西。如果你看到这个错误之前,我想AP preciate提示。

解决方案

机器人指令才又使用批处理文件Windows批处理文件工具\ lib目录\ find_java.bat 找到的Java。

在看看源,它执行以下操作:

  1. 查看是否的java.exe 是在 PATH
  2. 查找的java.exe 在某个地方在的%ProgramFiles%

您的问题,因为你使用的是64位版本的Windows的出现。这意味着的%ProgramFiles% C:\ Program Files文件,但Java是安装在 C: \程序文件(x86),因为它是一个32位应用程序,这意味着 find_java.bat 没有找到它。

因此​​,要解决这个问题就需要包含的java.exe 的目录添加到PATH环境变量中。

您需要将添加包含的java.exe 目录 - 像 C:\ Program Files文件(x86)的\的Java \ JDK6 \ BIN - 上的 PATH 到底用在它前面分号将它从previous进入分离。

<一个href="http://superuser.com/questions/25037/change-environment-variables-as-standard-user-windows-7">This在superuser.com 问题包括维护环境变量在Windows 7中。

I'm having a problem getting my android dev environment setup in Windows 7. I follow the instructions here, as well as several environment sublinks. I am using Eclipse with the Android plugin. I have installed the Java JDK several times, in various locations (jdk-6u20-windows-i586.exe) - but I am obviously missing something.

Every time I run "android create avd --target 2 --name my_avd" I get an error:

    C:\Users\andrew>android create avd --target 2 --name my_avd

WARNING: Java not found in your path.
Checking it it's installed in C:\Program Files\Java instead.


ERROR: No suitable Java found. In order to properly use the Android Developer
Tools, you need a suitable version of Java installed on your system. We
recommend that you install the JDK version of JavaSE, available here:
  http://java.sun.com/javase/downloads/

You can find the complete Android SDK requirements here:
  http://developer.android.com/sdk/requirements.html

This error message is the reason for me installing the JDK several times over. First I tried installing to a location on my e: drive. I then moved it to the default loc (program files (x86)\java\jdk.6.something. I also tried forcing it to go into the program files\ path, but it still automatically installs into the (x86) path. I have added the install path to my path environment variable every single time, yet I still continue to get this error. My suspicion is that windows 7 and the android tools are not playing together well in terms of finding the JDK, but who knows, it may be something entirely different. If you have seen this error before, I would appreciate a hint.

解决方案

The android command is just a Windows Batch file which in turn uses the batch file tools\lib\find_java.bat to find Java.

Having a look at the source, it does the following:

  1. Looks to see if java.exe is on your PATH.
  2. Looks for java.exe in somewhere under %ProgramFiles%

Your problem arises because you're using the a 64-bit version of Windows. This means %ProgramFiles% is C:\Program Files but Java is installed in C:\Program Files (x86) as it's a 32-bit application, meaning find_java.bat doesn't find it.

So to fix this you'll need to add the directory containing java.exe to your PATH environment variable.

You'll need to the add the directory containing java.exe - something like C:\Program Files (x86)\Java\jdk6\bin - on to the end of PATH with a semicolon in front of it to separate it from the previous entry.

This question on superuser.com covers maintaining Environment Variables in Windows 7.

这篇关于&QUOT; Android的创建和QUOT;调用失败在Windows 7 - 缺少JDK的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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