本文轉自:http://www.cnblogs.com/thinkfeed/archive/2012/08/02/2619748.html
今天基本完成了GPSMI客戶端的工作,還有幾張圖片要處理下,然後就進入SDK的tools目錄找到draw9patch.bat文件,運行時發現無法找到java.exe,出現一下信息。
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
You can find the complete Android SDK requirements here:
http://developer.android.com/sdk/requirements.html
剛開始還真以爲是我的JDK版本問題,就開始卸載了jdk,從官網下載了最新的jdk 7,安裝完成後發現還是同樣的錯誤。
怎麼辦呢?
用編輯器打開draw9patch.bat發現這段代碼,這個是用來查找java的。
rem Check we have a valid Java.exe in the path.
set java_exe=
call lib\find_java.bat
if not defined java_exe goto :EOF
繼續找到find_java.bat,用編輯器打開,將下面兩行代碼裏面的的-s參數刪除就可以了。
or /f %%a in ('%~dps0\find_java.exe -s') do set java_exe=%%a
for /f %%a in ('%~dps0\find_java.exe -s -w') do set javaw_exe=%%a
替換成
or /f %%a in ('%~dps0\find_java.exe') do set java_exe=%%a
for /f %%a in ('%~dps0\find_java.exe -w') do set javaw_exe=%%a
由於我使用的是window 7 x64 和jdk x64,都是64位的,使用32位的jdk應該不會有這個問題,如果你不想安裝32位的jdk可以試試我的方法。