Search Unity

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

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

  1. Stahlwolle

    Stahlwolle

    Joined:
    Jan 3, 2014
    Posts:
    1
    Hey guys,

    i realy tried out ALL of the posted workarounds to fix the goddamn message (Unable to find suitable jdk installation.)
    i set the JAVA_HOME variable to

    1) C:\Program Files\Java\jdk1.7.0_45\bin
    2) C:\Program Files\Java\jdk1.7.0_45\
    3) C:\Program Files\Java\jdk1.7.0_45\bin\java.exe

    NOTHING works for me. I am using the free Unity (v 4.3.2 f1) and Java 7.045.
    due to postings from august 2013 and unity v4.2 i wonder why it needs goddamn such long to fix this unfinished business by now.

    common unity DEVs. why cant you implement an correct routine which searchs and finds the "§()="(§=ing JAVA installation?!

    pleasepleasepleaseplease fix it or someone PLEASE tell me how to fix it by myself. solutions posted by now didnt work for me.

    using win 8, 64bit
    thx
     
  2. Brickit

    Brickit

    Joined:
    Jul 4, 2012
    Posts:
    30
    64 bit windows + jdk 64 + Unity 4.3.2f

    I have set the JAVA_HOME to

    1) C:\Program Files\Java\jdk1.7.0_45\bin
    2) C:\Program Files\Java\jdk1.7.0_45\
    3) C:\Program Files\Java\jdk1.7.0_45\bin\java.exe

    and added
    C:\Program Files\Java\jdk1.7.0_45\bin
    to the PATH

    also with no result. Unity just refuses to find java.

    However if i type java at the command line it is most certainly pathed correctly.

    Is this a Unity bug am i wasting my time trying to fight it?
     
    Last edited: Jan 3, 2014
  3. andez

    andez

    Joined:
    Jan 1, 2014
    Posts:
    3
    got this exception tried everything i can think of ,

    System.ComponentModel.Win32Exception: ApplicationName='java.exe', CommandLine='-Xmx1024M -Dfile.encoding=UTF8 -jar "F:/Editor/Data/BuildTargetTools/AndroidPlayer\sdktools.jar" -', CurrentDirectory='C:\Users\Andy\Documents\New Unity Project'

    if anyone has a clue could you help a novice please
     
  4. alsharefeeee

    alsharefeeee

    Joined:
    Jul 6, 2013
    Posts:
    80
    this problem happen to me whenever I re install windows and I solve it by downloading JDK 32 bit even so I have windows 64....stupid Unity.
     
  5. nereus

    nereus

    Joined:
    Jan 3, 2014
    Posts:
    1
    Problem Fixed!!!!

    After trying many of the methods mentioned here, I realized I had only the 64bit version of the jdk installed. I installed the 32bit version and without any additional setup, the problem was fixed!
     
  6. andez

    andez

    Joined:
    Jan 1, 2014
    Posts:
    3
    well for some reason its working now ,
    all I've done was reinstall Java and now its works and that's the 64 bit version ..... go figure.
     
  7. Brickit

    Brickit

    Joined:
    Jul 4, 2012
    Posts:
    30
    I uninstalled 64bit JDK and installed the 32bit, Now it works :/
     
  8. Mischief_Cody

    Mischief_Cody

    Joined:
    Nov 24, 2012
    Posts:
    8
    I can confirm that after changing Comodo's sandbox settings to deactivated I had no need for any java variables and Unity compiled the apk fine. Thank you Patico!
     
  9. leebs0117

    leebs0117

    Joined:
    Jul 1, 2013
    Posts:
    7
    solved !!!

    I use Unity4.3.3 + JDK 1.7

    (1)set JAVA_HOME, JDK_HOME, PATH CLASSPATH to the JDK folder ,
    (2)close Unity (If Unity is Opened)
    (3)Open Unity
    (4) solved !!!

    If Unity is running set JAVA_HOME, JDK_HOME, PATH CLASSPATH will NOT help.
     
  10. twburger

    twburger

    Joined:
    Jan 18, 2014
    Posts:
    3
    Yes, that's it. I set up JAVA_HOME = D:\Program Files\Java\jdk1.7.0_45\ and it works. My question is where did it get the default path from and can it be edited in a Unity configuration setting?

     
  11. Mehrdad995

    Mehrdad995

    Joined:
    Jul 17, 2013
    Posts:
    46
    Just wanted to mention that don't forget to relaunch Unity after changing System variables.
    Mine worked in that way
     
  12. kazamaninja

    kazamaninja

    Joined:
    Aug 3, 2012
    Posts:
    1
    Solid Solution on jdk 7!!!!

    Hey guys, im running windows 8, i tried a whole bunch of the suggested solutions above..but what seems to do the trick was right licking the Jdk install, properties, under compatiblity mode, changing from "vista" to "win 7"... i ran the install again and Disco! it worked...Note i had set the Path to the above metioned method..it may or may not effect the out come..good luck
     
  13. hieudev

    hieudev

    Joined:
    Feb 16, 2014
    Posts:
    12
    i`ve done all the above plus disabled the COMODO's(firewall) sand box and it works finally, so look out your security settings.
     
  14. szd00@yahoo.com

    szd00@yahoo.com

    Joined:
    Aug 25, 2012
    Posts:
    1

    worked for me

    I use Unity4.3.4 + JDK 1.7 :D
     
  15. lvh

    lvh

    Joined:
    Feb 25, 2014
    Posts:
    1
    Thank you sir, this helped me. Installed the 32-bit JDK on top of the 64 bit version.
     
  16. chall3ng3r

    chall3ng3r

    Joined:
    May 27, 2013
    Posts:
    23
    Phew!

    Happened to me again on new install of Win8.1 Pro. I tried many options in this thread, and this little trick described in this thread helped. So, anyone having hard time fixing Android builds giving JDK error should do this.

    First, I'm on Windows8.1 with JDK1.7-64bit, installed Android Studio bundle.

    - Open System Properties (Win+X -> System)
    - Click Advance system settings
    - Click Environment Variables...
    - Under System variables list, double-click PATH
    - IMPORTANT: add the JDK bin folder to START of the PATH variable, then semicolon, and rest of the path

    $jdk-path-setup.png

    That's all. Start Unity3D, and Build your Android game, it should compile alright.

    // chall3ng3r //
     
  17. fafase

    fafase

    Joined:
    Jul 3, 2012
    Posts:
    163
    Just for info, last one did it for me.

    Cheers
     
  18. Rrtaya_Tsamsiyu

    Rrtaya_Tsamsiyu

    Joined:
    Mar 22, 2014
    Posts:
    1
    Putting the name as JDK_HOME instead of JAVA_HOME when setting the variable worked for me.
    Also, for those who don't know what the variable is about, right click Computer, go to Proprieties, then click Advanced system settings on the left, then click Environment Variables, and click New under System variables.
     
  19. Talavang

    Talavang

    Joined:
    Aug 26, 2011
    Posts:
    4
    thanks...a lot !!!
     
  20. Aaike64

    Aaike64

    Joined:
    Mar 19, 2014
    Posts:
    1
    i had the same problem, windows 8 64bits.
    To solve it, you need to install java jdk for 32bits, and set the JAVA_HOME TO C:\Program Files (x86)\Java\jdk1.7.0_51

    good luck;
     
  21. Nitrohex

    Nitrohex

    Joined:
    Jan 16, 2013
    Posts:
    58
    I had the same problem, and this worked for me to.

    Thanks
     
  22. Plosivity

    Plosivity

    Joined:
    Apr 5, 2014
    Posts:
    1
    Thanks so much for this. Helped me fix the issue on Windows 8.1, running with JDK 1.6. :)
     
  23. MS80

    MS80

    Joined:
    Mar 7, 2014
    Posts:
    346
    Thx Patico! I can confirm this, too! After uninstalling, installing, setting all environment variables, try and error => i found your answer and a bolt hit my brain!! Comodo Firewall blocked it without any sign! I think Comodo is a good firewall/antivirus package, but for this reason i hate it over all! It tricked some times in the past, just blocking something and after hours you recognize its comodo again :mad:
     
  24. Djaydino

    Djaydino

    Joined:
    Aug 19, 2012
    Posts:
    48
    CONFIRMED!!!

    just installed jdk x86 version and it worked!
    tried almost all of the other solutions here but nothing worked for me.
    maybe not an issue from unity but from the jdk x64 version.
    i also REMOVED the variable and it still works
     
  25. avoliva

    avoliva

    Joined:
    Mar 23, 2013
    Posts:
    1
    Indeed, Windows 8 64 here, unintalled and reinstalled x86 version and it worked. I didn't have to change any environment variables or anything.

    Also I installed JDK 7 not 8.
     
  26. gusstimation

    gusstimation

    Joined:
    Jun 16, 2014
    Posts:
    1
    Solved for me also.
    Add in an environment variable as shown e.g. JAVA_HOME and C:\Program Files\Java\jdk1.8.0_05\.

    THEN CLOSE UNITY!


    This last step is what took too long to figure out!
     
  27. ReaperMK

    ReaperMK

    Joined:
    Feb 13, 2014
    Posts:
    1
    My issue was simply that I had JDK set up and I forgot to install regular java... The moment I installed plain old java (www.java.com) all my problems were solved... I also went through and did the environment var changes for system.
     
  28. threebrothersstudio

    threebrothersstudio

    Joined:
    Mar 18, 2014
    Posts:
    20
    I HAVE THE SAME PROBLEM BEFORE BUT I SOLVE IT MYSELF.

    VERY SIMPLE!!!!!..... uninstall the 64 bit version of jdk then install the 32 bit version.. JUST DO THAT AND IT WILL WORKS!.....
     
  29. Robert-Ramsay

    Robert-Ramsay

    Joined:
    Aug 28, 2013
    Posts:
    115
    Added 32bit version, solved!
     
  30. sateyr

    sateyr

    Joined:
    Mar 6, 2013
    Posts:
    10
    solved!

    I use Unity4.3.1f1 + jdk1.8.0_05

    (1)close Unity (If Unity is Opened)
    (2)add the JDK bin folder to START of the PATH variable


    (3)Open Unity
    (4) solved !!!
     
  31. S-dieters

    S-dieters

    Joined:
    Aug 27, 2013
    Posts:
    42
    Installing the 32bit version of my JDK solved everything for me.
     
  32. MilosK

    MilosK

    Joined:
    Aug 27, 2014
    Posts:
    2
    I just copied java.exe to C:\Windows folder and now everything is working fine. You can find java.exe in C:\Program Files\Java\jdk1.8.0_05\bin\. Hope this helps.
     
  33. JonnyHilly

    JonnyHilly

    Joined:
    Sep 4, 2009
    Posts:
    749
    Just setting this all up... noticed there area few choices.... JDK 7 JDK 7 for ARM, or JDK8... which should I install ? maybe 7 to be safe, but do I need this arm version ?
    thanks in advance
     
  34. Andy.zhou

    Andy.zhou

    Joined:
    Dec 18, 2014
    Posts:
    2
    thanks,fixed
     
  35. JonnyHilly

    JonnyHilly

    Joined:
    Sep 4, 2009
    Posts:
    749
    discovered a few things.... and some omissions from various unity/droid setup docs... here are a few notes to help other droid newbys like me...
    (I'm not posting detailed info on how to do each.... you can google that, but just posting notes on some things not to forget to do!)
    Same steps apply to both mac and PC

    1)don't forget to install Java JDK (not JDK for arm) and match the OS version to your machine 32 or 64 bit. At time of writing this 7.1 works, I didn't try 8. Its on the oracle site.
    2)install Eclipse
    3)install Android SDK (and beware of the windows path too long error from .zip file, right click and copy instead of using win zip to extract worked for me)
    4)Setup the environment variables JAVA_HOME and your bin folder in the PATH.
    5)Don't forget to install drivers for your device (for samsung, find the app 'kies')
    6)To get Eclipse to show any debug prints, you need to add "logcat" to the tabs in eclipse.
    7)Don't forget to point unity to the android SDK in unity prefs.
     
  36. duupreti

    duupreti

    Joined:
    Dec 3, 2013
    Posts:
    2
    I tried all the above things and it didn't help me :

    Setting the environment variable
    Updating jdk
    Correctly specifying Android sdk folder in Edit>Preferences>External Tools

    Again the error about incompatible java version was getting displayed.

    So I spotted the Unity 'Editor log file' in my Windows 7. For different platforms, it's located differently-

    Mac OS X - ~/Library/Logs/Unity/Editor.log
    Windows XP - C:\Documents and Settings\username\Local Settings\Application Data_\Unity\Editor\Editor.log
    Windows Vista/7 - C:\Users\username\AppData\Local\Unity\Editor\Editor.log


    The detailed error in the log file was:

    "
    Incompatible java version 'C:\Program Files (x86)\Java\jre6\bin\java.exe'
    C:\Program Files (x86)\Java\jre6\bin\java.exe -Xmx1024M -Dfile.encoding=UTF8 -jar
    "F:/Editor/Data/BuildTargetTools/AndroidPlayer\sdktools.jar" -
    stderr[
    Unable to access jarfile F:/Editor/Data/BuildTargetTools/AndroidPlayer\sdktools.jar
    ]
    stdout[
    ]

    "


    The error given in bold above caught my attention...and i went to F: ,then 'Editor' then 'Data' and couldn't find 'BuildTargetTools'.... so I made the folder, made 'AndroidPLayer' folder and this file 'sdktools.jar' which was probably missing from my version of Unity and it may be a bug, I got it from another possibly older installation of unity... luckily I had it somewhere else in my hard disks... And it worked. Don't know if this is installation fault or I had somehow deleted this sdktooks.jar or a bug in Unity but hope if u have this trouble, then may be this info would help you... Do check this log file and check the error if it was the same as mine.
     
  37. JonnyHilly

    JonnyHilly

    Joined:
    Sep 4, 2009
    Posts:
    749
    ..also..remember to reboot after setting up environment variables. and restart unity after any changes
     
  38. Skenderbee

    Skenderbee

    Joined:
    Oct 26, 2014
    Posts:
    3
    I had the same issue and I believe I have figured it out.
    Here is the breakdown:

    If your android SDK is 32-bit (which I believe is for all of you) you need to download the 32-bit Java SDK.
    32bit Java SDK is installed C:\Program Files (x86)\Java\jdk1.8.0
    64 bit Java SDK is installed in C:\Program Files\Java\jdk1.8.0

    You still need the JDK_HOME user variable set for Unity to compile your APK.
     
    Last edited: Jan 3, 2015
  39. sonicviz

    sonicviz

    Joined:
    May 19, 2009
    Posts:
    1,051
    Ran and built to android a couple of days ago with official 4.6.1 release just fine.

    I installed the latest Unity patch (4.6.1P4) and now I start getting this error and none of the fixes work.

    Get
    ==============================================================
    Failed java version detection for 'D:\Program Files (x86)\Java\jdk1.8.0_25\bin\java.exe'

    Incompatible java version 'D:\Program Files (x86)\Java\jdk1.8.0_25\bin\java.exe'

    UnityEditor.Android.CommandInvokationFailure: Incompatible java version 'D:\Program Files (x86)\Java\jdk1.8.0_25\bin\java.exe'
    D:\Program Files (x86)\Java\jdk1.8.0_25\bin\java.exe -Xmx2048M -Dfile.encoding=UTF8 -jar "D:/Program Files (x86)/Unity/Editor/Data/BuildTargetTools/AndroidPlayer\sdktools.jar" -

    stderr[

    ]
    stdout[
    Error occurred during initialization of VM
    Could not reserve enough space for 2097152KB object heap
    ]

    at UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) [0x00000] in <filename unknown>:0

    at UnityEditor.Android.AndroidSDKTools.RunCommand (System.String javaExe, System.String sdkToolsDir, System.String[] sdkToolCommand, Int32 memoryMB, System.String workingdir, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) [0x00000] in <filename unknown>:0

    Failed java version detection for 'D:\Program Files (x86)\Java\jdk1.8.0_25\bin\java.exe'

    Incompatible java version 'D:\Program Files (x86)\Java\jdk1.8.0_25\bin\java.exe'

    UnityEditor.Android.CommandInvokationFailure: Incompatible java version 'D:\Program Files (x86)\Java\jdk1.8.0_25\bin\java.exe'
    D:\Program Files (x86)\Java\jdk1.8.0_25\bin\java.exe -Xmx2048M -Dfile.encoding=UTF8 -jar "D:/Program Files (x86)/Unity/Editor/Data/BuildTargetTools/AndroidPlayer\sdktools.jar" -

    stderr[

    ]
    stdout[
    Error occurred during initialization of VM
    Could not reserve enough space for 2097152KB object heap
    ]

    at UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) [0x00000] in <filename unknown>:0

    at UnityEditor.Android.AndroidSDKTools.RunCommand (System.String javaExe, System.String sdkToolsDir, System.String[] sdkToolCommand, Int32 memoryMB, System.String workingdir, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) [0x00000] in <filename unknown>:0

    Failed java version detection for 'java.exe'

    Incompatible java version 'java.exe'

    UnityEditor.Android.CommandInvokationFailure: Incompatible java version 'java.exe'
    java.exe -Xmx2048M -Dfile.encoding=UTF8 -jar "D:/Program Files (x86)/Unity/Editor/Data/BuildTargetTools/AndroidPlayer\sdktools.jar" -

    stderr[

    ]
    stdout[
    Error occurred during initialization of VM
    Could not reserve enough space for 2097152KB object heap
    ]

    at UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) [0x00000] in <filename unknown>:0

    at UnityEditor.Android.AndroidSDKTools.RunCommand (System.String javaExe, System.String sdkToolsDir, System.String[] sdkToolCommand, Int32 memoryMB, System.String workingdir, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) [0x00000] in <filename unknown>:0

    Error building Player: UnityException: Unable to find suitable jdk installation. Please make sure you have a suitable jdk installation. Android development requires at least JDK 7 (1.7). The latest JDK can be obtained from the Oracle
    http://www.oracle.com/technetwork/java/javase/downloads/index.html
    =================================================================

    This was working before the upgrade to Unity 4.6.1 patch 4 but now it's not.

    I'm trying to fix a user crash due to Unity build failing on Intel android chip (which worked previously) and now I can no longer build to android to test latest patch.

    *sigh*

    Edit: Submitted bug report. Can you please fix this.
    Bug report: http://fogbugz.unity3d.com/default.asp?664473_r78jmvm99edc9a4t
     
    Last edited: Jan 19, 2015
  40. sonicviz

    sonicviz

    Joined:
    May 19, 2009
    Posts:
    1,051
    After pulling my hair out, smashing my head against a wall and screaming into the night scaring the crap out of the neighbours....

    I installed Unity 4.6.1 P3 with the same result as P4 = FAILURE
    Reinstalled Java JDK = FAILURE

    Reinstalled Unity 4.6.1 and I can build to Android again

    Unity, your patch build process is bugged with android and causes much horrible pain for paying customers

    I need to test the patches because I have crash reports and am hoping that *maybe* the patches have fixed them...or maybe I shouldn't...
     
  41. spacefrog

    spacefrog

    Joined:
    Jun 14, 2009
    Posts:
    734
    No problems here whatsoever, tested on OSX and on Windows: builds to Android work flawlessly...
     
  42. sonicviz

    sonicviz

    Joined:
    May 19, 2009
    Posts:
    1,051
    Good for you! I'd love to be in your shoes.
    However, due to the very existence of this thread, there appears to be a problem somewhere or other...
     
  43. sonicviz

    sonicviz

    Joined:
    May 19, 2009
    Posts:
    1,051
  44. grobm

    grobm

    Joined:
    Aug 15, 2005
    Posts:
    217
    Ok, having the same issue but on MacOS 10.10, Unity 4.6.21f. Suggestions to fix on Mac?

    /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java??? does not appear to work.
     
  45. sistemlogikadigital

    sistemlogikadigital

    Joined:
    Feb 8, 2015
    Posts:
    1
    after configure Environment variable, you must restart unity,

    it worked for me
     
  46. summerrain_90

    summerrain_90

    Joined:
    Aug 9, 2012
    Posts:
    1
    install jdk x86 and it worked for me.
     
  47. gull

    gull

    Joined:
    Nov 18, 2014
    Posts:
    4
    i updated my unity 4.6.0p1 to unity 4.6.3p4 and got this error, updated jdk to jdk1.7.0_75 but still same error. using windows 7 error detail is listed below.
    Error building Player: UnityException: Unable to find suitable JDK installation. Please make sure you have a suitable JDK installation. Android development requires at least JDK 7 (1.7), having JRE only is not enough. The latest JDK can be obtained from the Oracle website
    http://www.oracle.com/technetwork/java/javase/downloads/index.html
    any fixes for this error in unity 4.6.3p4?
     
  48. faraz

    faraz

    Joined:
    Aug 4, 2014
    Posts:
    46
    this not working for me :(
     
  49. lloydv

    lloydv

    Joined:
    Sep 15, 2015
    Posts:
    55
    I was getting this error. After frustrating myself with system variables for an hour, I found that that wasn't my problem at all.

    The actual culprit for me was a really old installation of Java from like 4 years ago that I didn't even realize I had (and it wasn't appearing in Java folder, either!)

    I noticed it because of this line in the Unity Editor log file: "System.Exception: Incompatible java version: 1.6.0_26"

    So I went to my "Programs and Features" list (Control Panel) and lo-and-behold there it was. Java 6 Update from 2011. Uninstalled and bam, no more build error silliness.
     
  50. draber

    draber

    Joined:
    Dec 3, 2014
    Posts:
    4
    Just a quick post for people using Unity 5.x - Unity now allows you to set the JDK to use under "External Tools" in the Preferences window. If you know you already have the JDK installed, just browse to its location and you're all set. No amount of setting JAVA_HOME or any other environment variable will fix any problem with different java versions.

    Don't make the mistake I did and spend a bunch of time setting environment stuff if you're using a newer Unity version!
     
    rainabba likes this.