“Android Create” call fails in windows 7 - missing JDK

前端 未结 8 788
孤独总比滥情好
孤独总比滥情好 2020-12-05 21:43

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 wi

相关标签:
8条回答
  • 2020-12-05 21:47

    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
    
    0 讨论(0)
  • 2020-12-05 21:47

    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!

    hth,

    \ ^ / i l l

    0 讨论(0)
  • 2020-12-05 21:52

    C:\Windows\SysWOW64

    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!

    0 讨论(0)
  • 2020-12-05 22:01

    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
    
    :SearchJavaW
    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.

    0 讨论(0)
  • 2020-12-05 22:05

    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.

    0 讨论(0)
  • 2020-12-05 22:06

    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.

    0 讨论(0)
提交回复
热议问题