[Android] “Failed to find Java version for ‘C:\Windows\system32\java.exe”問題的解決方案

來源:互聯網
上載者:User
Impossible to install SDK r17 on win 7 x64

"Failed to find Java version for 'C:\Windows\system32\java.exe"問題的解決方案

OS: Windows 7 x86 64bit
JDK installed: http://download.oracle.com/otn-pub/java/jdk/7u3-b05/jdk-7u3-windows-x64.exe

Option #1
Execute Android SDK installer

http://dl.google.com/android/installer_r17-windows.exe

Actual result - it can not find JAVA on the system.

Environment variable JAVA_HOME, PATH and recommendation from different forums about registry key didn't help (like here http://codearetoy.wordpress.com/2010/12/23/jdk-not-found-on-installing-android-sdk/)

Option #2
Execute tools/android.bat from

http://dl.google.com/android/android-sdk_r17-windows.zip

Actual result:
Failed to start with the error in console: "Failed to convert path to a short DOS path: C:\Windows\system32\java.exe"

How I fixed this:
In the file android-sdk-windows\tools\lib\find_java.bat
-for /f %%a in ('%~dps0\find_java.exe -s') do set java_exe=%%a
+for /f %%a in ('%~dps0\find_java.exe') do set java_exe=%%a

Suggestions - it is obvious that find_java.exe has a bug in conversion long names to short one (at least if no any conversion is required)

紅字部分為解決方案,這種方法需要使用zip包的Android SDK,而不能使用exe格式的,然後在android-sdk-windows\tools\lib\find_java.bat

檔案中:

-for /f %%a in ('%~dps0\find_java.exe -s') do set java_exe=%%a
+for /f %%a in ('%~dps0\find_java.exe') do set java_exe=%%a

然後再運行android.bat就可以了。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.