简体   繁体   English

Android.bat无法运行Java

[英]Android.bat can't run java

I know this question has been beaten to death but I still cannot get the SDK Manager to run on my Windows 7 Home. 我知道这个问题已被解决,但是我仍然无法让SDK Manager在Windows 7 Home上运行。

I downloaded the eclipse + adt bundle. 我下载了eclipse + adt软件包。 The SDK Manager.exe is in the sdk folder where I try to run it from. SDK Manager.exe位于sdk文件夹中,我尝试从中运行它。 I even tried copying it to the tools folder and tried running from there but no luck. 我什至尝试将其复制到tools文件夹并尝试从那里运行,但是没有运气。

The error I get is: 我得到的错误是:

Failed to execute tools\android.bat:
The system cannot find the file specified.

The file clearly exists. 该文件显然存在。 I tried running it as "Administrator" as well. 我也尝试以“管理员”身份运行它。

Next I tried running the android.bat file itself which says: 接下来,我尝试运行android.bat文件本身,内容为:

Windows cannot find 'E:\path\to\batfile'. 
Make sure you typed the name correctly, and then try again. 

I then ran it as "Administrator" which at least detects and tries to execute it. 然后,我以“管理员”身份运行它,至少它会检测并尝试执行它。 I added in a few pause statements to android.bat itself to prevent it from closing. 我在android.bat本身中添加了一些暂停语句,以防止其关闭。

Here is what I see: 这是我看到的:

'"E:\ADT\sdk\tools\lib\\find_java.exe" -s' is not recognized as an internal
or external command, operable program or batch file.

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

If you already have Java installed, you can define the JAVA_HOME environment
variable in Control Panel / System / Avanced System Settings to point to the
JDK folder.

Not sure why it says that because when I run where java in cmd I get this: 不知道为什么这样说,因为当我在cmd中的java中运行时,我得到了:

C:\Users\(MyUser)>where java
C:\Program Files\Java\jdk1.8.0_05\bin\java.exe
C:\ProgramData\Oracle\Java\javapath\java.exe
C:\Windows\System32\java.exe

And when I open cmd and manually run 当我打开cmd并手动运行时

'"E:\ADT\sdk\tools\lib\\find_java.exe" -s' 

it works fine. 它工作正常。

I then tried setting the java_exe in android.bat to 然后我尝试将android.bat中的java_exe设置为

set java_exe=C:\Program Files\Java\jdk1.8.0_05\bin\java.exe

After commenting out the find_java I ran it again and this is what I get: 注释掉find_java之后,我再次运行它,这是我得到的:

'"C:\Program Files\Java\jdk1.8.0_05\bin\java.exe" -jar lib\archquery.jar' is not
 recognized as an internal or external command,
operable program or batch file.
Invalid path

And once again, when I manually run it, I get: 再一次,当我手动运行它时,我得到:

C:\Users\MyUser>"C:\Program Files\Java\jdk1.8.0_05\bin\java.exe" -jar E:\ADT\sdk\t
ools\lib\archquery.jar
x86_64

Am I missing something or should I finally give up trying to get it to work on my windows machine. 我是否缺少某些东西,还是我应该放弃尝试使其在Windows机器上工作。

Your where java shows too many java.exe , the find_java.bat will try to look for javaw as well in the folder where java is. 您的where java显示太多java.exefind_java.bat也会尝试在java所在的文件夹中查找javaw

set JAVA_HOME and make sure the echo %PATH% points to your main jdk installation. 设置JAVA_HOME并确保echo %PATH%指向您的主要jdk安装。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM