[BUG]cocos creator cannot find java and cannot set up the JDK path manually

As the title said

when I try to build a native android app, it gives an error that [Error: Please make sure java is installed and JAVA_HOME is in your environment]

the error message point to AppData\Local\CocosCreator\app-1.1.0\resources\app.asar\editor\core\native-utils.js:1:1468, but the file "app.asar“ is a package that i cannot modify it, also, i cannot find any entry to update the JDK path manually.

Platform: windows 7. with cocos creator 1.1.0

you need add JAVA_HOME to your system

right click my computer click on “properties” then click on
“advanced system settings” then click on “Environment variables” then under “user variables” click on “New” then "variable name: JAVA_HOME and variable value “path to jdk dir” then hit OK might need reboot system some time work with out rebooting

1 Like

I created the variable all right:
variable: JAVA_HOME
value: C: \ Program Files \ Java \ jdk1.8.0_66
Even though it works, it tells me that the variable is not on the correct path!

I also experienced the issue when building android studio project with Cocos Creator.

The environment variable JAVA_HOME in the system variables on my computer is:
“C:\tools\Java\jdk1.8.0_66\”

Only remove character ‘\’ at the end of the above string, the issue will be solved!
It should be “C:\tools\Java\jdk1.8.0_66”

Note that there is no any space character in the path of JAVA_HOME.

2 Likes

thank you! I was able to solve this problem!