Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Android-Unable to build -Jdk Error-unable to find Jdk

Discussion in 'Android' started by mobileappmogul, Jul 29, 2013.

  1. mobileappmogul

    mobileappmogul

    Joined:
    Jul 20, 2013
    Posts:
    12
    I keep getting this error message. "Unable to find suitable jdk installation Please make sure you have a suitable jdk installation.Android development requires at least JDK 6 (1.6)"

    Here is a short video of my problem

    http://screencast-o-matic.com/watch/cIiuDsVAeZ

    I have the JDK 1.7 installed on my computer. I am using windows 8 pro 64 version Unable to build -Jdk Error-unable to find Jdk

    Any help would be greatly appreciated. Thank you
     
    rainabba likes this.
  2. bukk530

    bukk530

    Joined:
    Jan 16, 2013
    Posts:
    2
    Same problem here!
    Have you already solved this issue?
     
  3. Lukas H

    Lukas H

    Joined:
    Jan 16, 2009
    Posts:
    394
    I had the same problem, it looks like its either a problem with Unity or the jdk installer.

    Either way, here's how I fixed it on Windows 7 64bit:
    1) Goto the control panel
    2) Open the System item
    3) Click "Advanced system settings" in the left bar
    4) A popup opens
    5) Click the Environment Variables button
    6) A popup opens
    7) In the User variables for USERNAME area click the New.. button
    8 ) Enter JDK_HOME as Variable name, enter the jdk installation path, in my case C:\Program Files (x86)\Java\jdk1.7.0_25\, this might be different in your case.
    9) Hit ok

    Try doing a build again, it should be working again
     
    idurvesh and exorakhilas like this.
  4. mobileappmogul

    mobileappmogul

    Joined:
    Jul 20, 2013
    Posts:
    12
    Hey Lukas, thanks for your reply. I just tried your suggestion and I still got the same error message.

    "Unable to find suitable jdk installation Please make sure you have a suitable jdk installation.Android development requires at least JDK 6 (1.6)

    any other suggestions?
     
    Last edited: Jul 30, 2013
  5. Lukas H

    Lukas H

    Joined:
    Jan 16, 2009
    Posts:
    394
    Out of nowhere the error came back, just between building, I hadn't even rebooted in between.

    Can you test something out?
    Open the windows taskmanager and close/kill the process adb.exe (if its started/opened)

    Way back, Unity v3.x had a problem with it being open when building (it would hang the build in that case)
     
  6. mobileappmogul

    mobileappmogul

    Joined:
    Jul 20, 2013
    Posts:
    12
    OKAY I FIGURED IT OUT (AFTER 4 DAYS). What I did was uninstall the jdk and reinstalled it but this time I READ THE DIRECTIONS ON THIS PAGE. that showed during the installation:

    http://docs.oracle.com/javase/7/docs...n-windows.html

    I scrolled down to this part:
    ================================================== ===============
    Updating the PATH Environment Variable (Optional)
    You can run the JDK without setting the PATH environment variable, or you can optionally set it so that you can conveniently run the JDK executable files (javac.exe, java.exe, javadoc.exe, and so forth) from any directory without having to type the full path of the command. If you do not set the PATH variable, you need to specify the full path to the executable file every time you run it, such as:

    C:\> "C:\Program Files\Java\jdk1.7.0\bin\javac" MyClass.java
    It is useful to set the PATH variable permanently so it will persist after rebooting.

    To set the PATH variable permanently, add the full path of the jdk1.7.0\bin directory to the PATH variable. Typically, this full path looks something like C:\Program Files\Java\jdk1.7.0\bin. Set the PATH variable as follows on Microsoft Windows:

    Click Start, then Control Panel, then System.

    Click Advanced, then Environment Variables.

    Add the location of the bin folder of the JDK installation for the PATH variable in System Variables. The following is a typical value for the PATH variable:

    C:\WINDOWS\system32;C:\WINDOWS;C:\Program Files\Java\jdk1.7.0\bin
    ================================================== ==========

    But I used this file PATH for my computer

    C:\Program Files\Java\jdk1.7.0_25\bin

    I had did this before but I did not add the "bin" at the end of the path.

    Also this video might help too.

    http://www.youtube.com/watch?feature...zzrqQoSE#at=95
     
  7. mobileappmogul

    mobileappmogul

    Joined:
    Jul 20, 2013
    Posts:
    12
    OKAY I FIGURED IT OUT (AFTER 4 DAYS). What I did was uninstall the jdk and reinstalled it but this time I READ THE DIRECTIONS ON THIS PAGE. that showed during the installation:

    http://docs.oracle.com/javase/7/docs...n-windows.html

    I scrolled down to this part:
    ================================================== ===============
    Updating the PATH Environment Variable (Optional)
    You can run the JDK without setting the PATH environment variable, or you can optionally set it so that you can conveniently run the JDK executable files (javac.exe, java.exe, javadoc.exe, and so forth) from any directory without having to type the full path of the command. If you do not set the PATH variable, you need to specify the full path to the executable file every time you run it, such as:

    C:\> "C:\Program Files\Java\jdk1.7.0\bin\javac" MyClass.java
    It is useful to set the PATH variable permanently so it will persist after rebooting.

    To set the PATH variable permanently, add the full path of the jdk1.7.0\bin directory to the PATH variable. Typically, this full path looks something like C:\Program Files\Java\jdk1.7.0\bin. Set the PATH variable as follows on Microsoft Windows:

    Click Start, then Control Panel, then System.

    Click Advanced, then Environment Variables.

    Add the location of the bin folder of the JDK installation for the PATH variable in System Variables. The following is a typical value for the PATH variable:

    C:\WINDOWS\system32;C:\WINDOWS;C:\Program Files\Java\jdk1.7.0\bin
    ================================================== ==========

    But I used this file PATH for my computer

    C:\Program Files\Java\jdk1.7.0_25\bin

    I had did this before but I did not add the "bin" at the end of the path.

    Also this video might help too.

    http://www.youtube.com/watch?feature...zzrqQoSE#at=95
     
  8. bukk530

    bukk530

    Joined:
    Jan 16, 2013
    Posts:
    2
    I figured out, set as JAVA_HOME C:\Windows\System32\java.exe
     
    AbgaryanFX likes this.
  9. danderham

    danderham

    Joined:
    Jul 28, 2013
    Posts:
    4
    This hasn't resolved the issue for me. I'm on Windows 7 x64. I have tried the following:
    - Uninstalled all JDKs.
    - Re-installed 1.7 32 bit, 1.7 x64, 1.6 32 bit, 1.6 x64 one at a time, rebooting in between.
    - Each time updated JAVA_HOME, JDK_HOME, PATH CLASSPATH to the JDK folder (correctly linking to the root or bin where necessary).
    - Tried moving out java.exe from System32.
    - Re-installed Android SDK (r21).

    When I installed Unity on Saturday it was working fine, the next day it prompted me to upgrade to Android SDK r22 which I think is when it stopped working, but going back to r21 hasn't helped.
     
    Last edited: Jul 31, 2013
  10. Lukas H

    Lukas H

    Joined:
    Jan 16, 2009
    Posts:
    394
    Its back with a vengeance here too. Ever since Unity 4.2 its started to bug on me.
    I tried all the steps you describe too, with no luck...
     
  11. danderham

    danderham

    Joined:
    Jul 28, 2013
    Posts:
    4
    After spending another 4 hours or so on this I managed to get it working. I noticed in my unity editor log it was throwing an error that it could not access a folder (because it didn't exist), this folder was completely unrelated to Unity and Java (it was a location of an Havok based android project), so I've got no idea why it was trying to access it. Anyway, I created this folder and it was then able to find the JDK.

    So if anyone still has this issue then I suggest looking at this log, which can be viewed from the bug log dialog and making sure all errors are resolved, even if they appear unrelated.
     
  12. _nayr4

    _nayr4

    Joined:
    Aug 8, 2013
    Posts:
    1
    this worked for me.. i'm using unity 4.2 free, jdk 1.7 64bit and windows 8..
     
  13. bitter

    bitter

    Unity Technologies

    Joined:
    Jan 11, 2012
    Posts:
    530
    Hey, that is really interesting. You don't happen to still have that log file or the exact error that was thrown?
     
  14. bitter

    bitter

    Unity Technologies

    Joined:
    Jan 11, 2012
    Posts:
    530
    @Lukas, if you are still experiencing this problem would you mind posting the error that is presented in the editor log file?
     
  15. Lukas H

    Lukas H

    Joined:
    Jan 16, 2009
    Posts:
    394
    I still have this issue and I'm going bonkers over it, I actually gave up untill I saw your post.
    Just now I wanted to build and it failed. I try again, without restarting my pc or unity and it just works. Which tells me it not a problem on my setup.

    I'll attach the log to bug report Case 554728 (I did that a week ago or so)
     
    Last edited: Aug 10, 2013
  16. bitter

    bitter

    Unity Technologies

    Joined:
    Jan 11, 2012
    Posts:
    530
    Thank you Lukas!!! That log file explains what is happening.

    Code (csharp):
    1.  
    2. stderr[
    3. Error: Could not create the Java Virtual Machine.
    4. Error: A fatal exception has occurred. Program will exit.
    5. ]
    6. stdout[
    7. Error occurred during initialization of VM
    8. Could not reserve enough space for object heap
    9. ]
    10.  
    As you can see the vm doesn't even spit out a version number for us to check. We created a fix for this memory issue, but we must have missed the version check. I'll try to squeeze in a fix asap.
     
  17. Lukas H

    Lukas H

    Joined:
    Jan 16, 2009
    Posts:
    394
    Super awesome! You just made my day :)
     
  18. Fide

    Fide

    Joined:
    Aug 19, 2013
    Posts:
    2
    Hi,
    i get the same problem. I am not able to build an apk-file, because Unity could not find the JAVA-SDK.
    I get exactly the same error log-file. I have tried to reinstall Unity and JAVA SDK. Nothing helps.
     
  19. seanlloydbooth

    seanlloydbooth

    Joined:
    Jan 12, 2012
    Posts:
    60
    Same thing happening here... Don't suppose there is a quick fix our end is there?
     
  20. Lukas H

    Lukas H

    Joined:
    Jan 16, 2009
    Posts:
    394
    Its fixed in 4.2.1.

    I don't know if there is a workaround but if you try 1 out of 10 builds will succeed. I'm just hoping you don't have 52 scenes like me and building takes 3minutes ;)
     
  21. seanlloydbooth

    seanlloydbooth

    Joined:
    Jan 12, 2012
    Posts:
    60
    My problem was I didn't set the PATH variable properly... Feeling a bit daft now :p

    Mobileappmogul's suggestion to add /bin to the end actually stopped it working for me and throwing up that error. Strange, but meh.
     
  22. Fide

    Fide

    Joined:
    Aug 19, 2013
    Posts:
    2
    But 4.2.1 is not released right now.
    The problem is, that It's never worked for me on this computer. After 10 builds, I have 0 successes.
     
  23. jazzcake_home

    jazzcake_home

    Joined:
    Aug 22, 2013
    Posts:
    2

    I have the same problem in Unity 4.12.

    As result, it is caused by conflict with path of Android which are defined in system environment and set in preferences of Unity.
    So I removed all set in system environment and reset valid path in preferences of Unity.

    Then not show such error any more.
     
  24. rudware

    rudware

    Joined:
    Aug 29, 2013
    Posts:
    1
    1. Uninstall Unity
    2. Remove registry about Unity3D
    path = HKEY_CURRENT_USET \ Software \ Unity Technologies
    3. Remove Unity folder
    4. Reinstall Unity
    5. Happy Unity
     
  25. ChuZ

    ChuZ

    Joined:
    Aug 31, 2013
    Posts:
    1
    Has anyone found a solution yet? I've tried everything mentioned already, set the environment variables, reinstalled both Unity and the JDK, as well as removed registry keys to no avail. I may have to revert back to Unity 3 since nothing is working.
     
  26. Jianzhizhan

    Jianzhizhan

    Joined:
    Sep 2, 2013
    Posts:
    1
    I have tried all solutions mentioned in this thread too, and still got the same error:
    Error building Player: UnityException: Unable to find suitable jdk installaion Please make sure you have a suitable jdk installation. Android development requires at least JDK 6 (1.6). The latest JDK can be obtained from the Oracle

    my computer ENV: WIN7_64 + JDK 1.7 + UNITY 4.2
     
  27. frikic

    frikic

    Joined:
    Dec 22, 2011
    Posts:
    44
    I want to report same problem here, with same operation system
     
  28. gv

    gv

    Joined:
    Feb 22, 2013
    Posts:
    89
    I am getting this same error... how can I fix this ??
     
  29. kilian277

    kilian277

    Joined:
    Jul 13, 2012
    Posts:
    54
    Sam problem here , tried everything still not working.

    Before i updated to 4.2.1 i didn't had this problem everything was building correctly and since 4.2.0 i have this error , it's so frsutating because i can't build my android projects anymore and i need them done !
     
  30. kilian277

    kilian277

    Joined:
    Jul 13, 2012
    Posts:
    54
    Nevermind got it working again :D

    I just changed the ANDROID_SDK_ROOT to this dir C:\Users\[USER]\AppData\Local\Android\android-sdk

    And then it just magically worked again :D

    Maybe this wil help for someone else
     
    Vrbaski43 likes this.
  31. DFG

    DFG

    Joined:
    Oct 18, 2011
    Posts:
    61
    How can it be fixed for mac?



    Thanks!



     
  32. Akisaur

    Akisaur

    Joined:
    Sep 16, 2013
    Posts:
    1
    Also having the same problem. I have done everything in this thread and in others, nothing is working.
     
  33. DFG

    DFG

    Joined:
    Oct 18, 2011
    Posts:
    61
    Also please note using osx 10.8.5 maybe this caused an issue???
     
  34. shinichi88

    shinichi88

    Joined:
    May 4, 2011
    Posts:
    80
    My case: WIN 7 64bit with Java 1.6 1.7 , JDK JRE both 32 64 bit installed
    My problem solve after I've change the ANDROID_SDK_ROOT path...

    Initially the path was "../android/android-sdk"
    So i found that the error log reporting couldn't find root directory of the sdk..

    As i remember i did download Android ADT bundle and the directory had change since then to something "../android/sdk"
    So i delete the old folder "../android/android-sdk"

    Unity 4.1.xf doesn't seem to care about this ANDROID_SDK_ROOT path... but Unity 4.2 does!!
    So get back to your System Environment Variable and edit your ANDROID_SDK_ROOT..
    Once done, restart your PC.. and problem solve.
     
  35. bugoheyer

    bugoheyer

    Joined:
    Jul 23, 2013
    Posts:
    35
    AFTER EVERYTHING here I tried this, and it worked! Thanks so much!
     
  36. Kurius

    Kurius

    Joined:
    Sep 29, 2013
    Posts:
    412
  37. donmetapod

    donmetapod

    Joined:
    Jul 26, 2013
    Posts:
    3

    This steps worked for me:

    -Uninstall jdk7_45
    -Uninstall java update 45
    -Uninstall GTK# (I'm not sure if this is entirely necessary)
    -Reboot system
    -Install jdk again selecting the option to install java also
    -Reboot system
    -Have fun

    note: I'm using Unity 4.2..2f1 on windows 8 pro x64
     
  38. bitter

    bitter

    Unity Technologies

    Joined:
    Jan 11, 2012
    Posts:
    530
    For anyone reading this thread and seeing "Unable to find suitable jdk installation Please make sure you have a suitable jdk installation.Android development requires at least JDK 6 (1.6)". First thing you should do is upgrade Unity to 4.2.2. We fixed a bug in our SDKTools library that would cause this error message even though a correct JDK is installed on the machine.

    If that doesn't help make sure the JAVA_HOME environment variable has been set to a proper JDK installation. JAVA_HOME is the first thing unity will look at while searching for a proper JDK installation.
     
  39. maesty

    maesty

    Joined:
    Oct 5, 2012
    Posts:
    2
    Path variable was the problem for me, Win 8.1, jdk and anroid sdk in 64bit. None of the installers had added anything to the PATH variable. Initially I changed it to

    %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files\Java\jdk1.7.0_45\bin

    which did noit work. I found somewhere else that having the java location first in PATH is required. So now I have this

    C:\Program Files\Java\jdk1.7.0_45\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\

    and everything works fine.

    N.B. I also set up JDK_HOME variable but it doesn't seem to be used anything from running the android sdk maanger to pushing a new build over the adb from unity.
     
  40. bitter

    bitter

    Unity Technologies

    Joined:
    Jan 11, 2012
    Posts:
    530
    That is correct - Unity completely ignores JDK_HOME. You have to set JAVA_HOME.
     
  41. Funtownarcade

    Funtownarcade

    Joined:
    Nov 6, 2012
    Posts:
    9
    If anyone else was having this issue I was there as well, even with editing path variables and re installing. Today I tried installing the latest 32bit java and android SDK's (running Windows 8.1 64bit) with all default settings its finally working for me. :grin: I'm stoked to see my game on my phone. It may have been the 64bit Android SDK causing me trouble.
     
    Last edited: Nov 1, 2013
  42. reckoner84

    reckoner84

    Joined:
    Nov 15, 2013
    Posts:
    9
    I'm am having this issue, i've been working on it for over 4 hours now. I have all my Environment Variables set up correctly (can access all java commands through cmd (from C:\))
    My Android SDK manager was also not working, but that has been resolved through the EnvVariables.

    I know still get the error of no jdk found even though the log says it is pointing right at it.
    Editor.log
    Failed java version detection for 'C:\Program Files (x86)\Java\jdk\bin\java.exe'

    I would love to see this line pointing at the wrong address, but that is exactly where it is.

    Any help would be appreciated.
     
  43. reckoner84

    reckoner84

    Joined:
    Nov 15, 2013
    Posts:
    9
    OK Scrub that -
    Set my JAVA_HOME to the full path of C:\Program Files (x86)\Java\jdk\bin\java.exe
    Works.

    Dosen't really make sense after reading all of the oracle documentation. But I honestly don't care anymore.
     
  44. reckoner84

    reckoner84

    Joined:
    Nov 15, 2013
    Posts:
    9
    Same error is now back again.

    I'm really getting annoyed with this now. Should be so simple.

    Any help would be appreciated.
     
  45. Patico

    Patico

    Joined:
    May 21, 2013
    Posts:
    886
    OHH YEAH!!! I'VE SOLVED IT!

    I tried to reinstall latest version of Unity, Android SDK, and JDK, but real reason was my Comodo Antivirus that blocked any java files used by Unity - the problem of 'unable to find suitable jdk installation' was solved after I added these files in trusted list and temporary deactivate Auto-Sandbox mode of antiviris! :p
     
    Last edited: Nov 19, 2013
  46. rohschinken

    rohschinken

    Joined:
    Nov 19, 2013
    Posts:
    4
    I can confirm this. For me Comodo Antivirus was causing those problems. Since I also had problems installing tortoise git I decided to completely uninstall Comodo and now git works as well as Android building with Unity. :)

    this issue drove me nuts since I was focusing on the system environment variables (tried every possible combination for the last 4 days with no luck :/)

    (Windows 8.1 64-bit, Unity 4.3.0f4)
     
  47. reckoner84

    reckoner84

    Joined:
    Nov 15, 2013
    Posts:
    9
    Legend.
    Can't believe it was a firewall issue, always the simple things.
     
  48. larku

    larku

    Joined:
    Mar 14, 2013
    Posts:
    1,422
    Thought I'd just try and make it obvious for others having this issue since there is a lot of different ideas thrown about in this thread.

    TO FIX THIS PROBLEM:

    Just set the JAVA_HOME environment variable to THE ROOT OF THE JDK FOLDER (not the bin folder, the java.exe or any other path).

    In my case this was:

    C:\Program Files\Java\jdk1.7.0_45\

    ...
     
  49. sama-van

    sama-van

    Joined:
    Jun 2, 2009
    Posts:
    1,734

    Same here, thanks it works.

    ( Windows 8 - Unity 4.3.1 -jdk1.7.0_45)
     
  50. clinesr

    clinesr

    Joined:
    Sep 16, 2012
    Posts:
    19
    Sorry to bump the thread, but for some of us Windows 7 x64 users that still can't get this to work here is what I did.

    I had to change the "Program Files" portion of my path to "Progra~1".
    No idea why I would need to use short file names for this, I'm guessing it has to do with the space between the words.

    In other words for me the path had to be written like this:
    "C:\Progra~1\Java\jdk1.7.0_45"

    "Progra~2" works for the "Program Files(x86)"