Home » Android » "Android Create" call fails in windows 7 – missing JDK

"Android Create" call fails in windows 7 – missing JDK

Posted by: admin June 15, 2020 Leave a comment


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:

You can find the complete Android SDK requirements here:

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.

How to&Answers:

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.


I had this same problem, after accidentally installed the 32-bit version of Java SDK. I uninstalled it and installed the 64-bit version (since I’m using Windows 7 64). The Android SDK setup never found Java correctly, even after I added it to my PATH variable!

After a bit of digging around, I discovered a java.exe floating around in my system32 folder, which in the order of the PATH variable came before my SDK path. After whacking the java.exe in my system32 folder, the Android Setup ran just fine!

Hope this helps.


It is really hell with JDK detection…

My params: Win 7 x64 + JDK x64 (JDK path (c:\Program Files\Java\jre7\bin)

Was googling and playing around with env variables may be 1 hour – no way.

Finally come with such solution

Manually edit android-sdk-windows\tools\lib\find_java.bat by hardcoding the path to java.exe

set java_exe=c:\Progra~1\Java\jre7\bin\java.exe
if not defined java_exe goto :CheckFailed

set javaw_exe=c:\Progra~1\Java\jre7\bin\javaw.exe
if not exist %javaw_exe% set javaw_exe=%java_exe%
goto :EOF

Thats works for me.


In the SDK tools folder go to libs and edit find_java.bat. It can usually be found in C:\Program Files (x86)\Android\android-sdk-windows\tools\lib.

Change all instances of %PROGRAMFILES% to %PROGRAMFILES(X86)%.

I did this and the error went away.


Find android-sdk-windows\tools\lib\find_java.bat and add something like the following:

set java_exe=
call :TestJavaDir "%JAVA_HOME%"
if defined java_exe goto :EOF


What worked for me was this:

add a path to your java/bin directory to the system Path variable. Do NOT include java.exe.

Steps on Win 7 64bit:

  • Click Windows Button
  • Right Click on Computer
  • Select Properties from the Context Menu
  • Click Advanced System Settings on the top left section
  • Click the Environment Variables… button at the bottom of the properties dialog
  • On the bottom list (System variables) find the “Path” variable
  • Click the Edit button
  • Go to the end of the textbox and type something like c:\program
    files\java\jdk1.6.0_26\bin (make sure it matches the name of your
    java directory!)
  • Click OK
  • Click OK
  • Click OK

Try it out!


\ ^ / i l l


I put rem statement in android.bat after the call command and hardcode the path of \bin\java.exe:

rem Check we have a valid Java.exe in the path.
set java_exe=<..>\jdk1.6.0_31\bin\java.exe
rem call lib\find_java.bat
if not defined java_exe goto :EOF

Same for setting other variable javaw_exe thus:

set javaw_exe=<..>\jre1.6.0_31\bin\javaw.exe
if not exist %javaw_exe% set javaw_exe=%java_exe%
goto :EOF



1down vote

I also had this same problem
-> accidentally installed the 32-bit version of Java SDK -> uninstalled -> installed the 64-bit version (Windows 7 64) -> -> the Android SDK setup never found Java correctly!

I discovered a java.exe floating around in C:\Windows\SysWOW64 folder.
After renaming this java.exe to javaX.exe, the Android Setup ran just fine!