JAVA_HOME is not set and no 'java' command could be found in your PATH

Hi,

I’m using the JDK and android sdk installed with unity but the player settings of android never open.

I always get the following errors.

I tried to set manually JAVA_HOME and PATH to ‘C:/dev/Unity/Installations/2019.2.2f1/Editor/Data/PlaybackEngines/AndroidPlayer/Tools\OpenJDK\Windows’ and ‘C:/dev/Unity/Installations/2019.2.2f1/Editor/Data/PlaybackEngines/AndroidPlayer/Tools\OpenJDK\Windows\bin’ in my computer’s environment settings, but I’m still getting the same error.
I tried running C:/dev/Unity/Installations/2019.2.2f1/Editor/Data/PlaybackEngines/AndroidPlayer/SDK\tools\bin\sdkmanager.bat --list from cmd and it ran without problems.

Thanks for advance.

3 Likes

Try unselecting and selectingagain the JDK checkbox.

35 Likes

Thank you for your reply.
I tried that. I also tried to manually point to the JDK path C:/dev/Unity/Installations/2019.2.2f1/Editor/Data/PlaybackEngines/AndroidPlayer/Tools\OpenJDK\Windows in the preferences, but I got the same weird error.

Upgrading to 2019.2.3f1 fixed the problem however.

1 Like

Oh my god… It was just as simple as that… I spent lot of time trying to figure out what was wrong…
Had this issue suddenly on unity 2019.3.13f1 (it was working and the day after it wasn’t).

anyway it’s fixed now ! thx for the tips :wink:

9 Likes

Hi I had the same error but i did not get your solution please?I will be very happy if you share. Thank you.

1 Like

+1

Uncheck jdk checkbox and paste jdk path manually:
C:\Program Files\2019.1.7f1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\OpenJDK\Windows\

10 Likes

Hi everyone, I have unchecked the box, closed preferences window then opened it again and checked the box. In that way it worked for me
However it’s strange to have such an unsual solution :slight_smile: I think it’s that restarting thing with computers :slight_smile:

8 Likes

Once again hi everyone, strangely today I had the same issue again. Although the automatically set path is correct, I did as playpes16 said and this time it worked. The path I pasted was the same as the automatically set one but this time Unity wanted in that way I guess :slight_smile:

3 Likes

Worked for me too uncheck/check

Hi All,
Had the exact same problem, working one day failed the next. This happened after a windows update, which I suspect may have caused the issue. Anyway, my fix was to select browse on JDK & SDK and select the same folders that they are supposedly addressing. Checking and unchecking did not work for me – guess it’s just buggy…

2 Likes

I can also verify the solution, although it is important that when unchecking, you have to close the preference window and then open it again and tick the checkbox again - then it will work.

1 Like

It happened to me to

Still didn’t work for me

1 Like

Worked like a charm…Though it worked after i did it for both jdk and android sdk…

2 Likes

Unity 2020.2.0f1
Still experiencing that issue.

Checking-unchecking / defining JAVA_HOME manually in the environment variables and other “mumbo-jumbo”-like solutions from the unity team don’t work for me.

Whem will that be fixed?

1 Like

how ? I cant uncheck Jdk chekbox to remove

check /uncheck worked like a charm

check /uncheck worked at 2019.4.16f

When is unity planning to fix this issue?