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

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

1 Like

Same problem here!
Have you already solved this issue?

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.
  8. Hit ok

Try doing a build again, it should be working again

2 Likes

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?

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)

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:

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.

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:

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.

I figured out, set as JAVA_HOME C:\Windows\System32\java.exe

1 Like

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.

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…

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.

this worked for me… i’m using unity 4.2 free, jdk 1.7 64bit and windows 8…

Hey, that is really interesting. You don’t happen to still have that log file or the exact error that was thrown?

@Lukas, if you are still experiencing this problem would you mind posting the error that is presented in the editor log file?

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)

Thank you Lukas!!! That log file explains what is happening.

stderr[
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
]
stdout[
Error occurred during initialization of VM
Could not reserve enough space for object heap
]

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.

Super awesome! You just made my day :slight_smile:

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.

Same thing happening here… Don’t suppose there is a quick fix our end is there?

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 :wink: