简体   繁体   中英

'java' is not recognized as an internal or external command, operable program or batch file

I am using java 12.0.2, JAVA_HOME is set as C:\Program Files\Java\jdk-12.0.2 and PATH is having %JAVA_HOME%\bin still when I try executing java command its giving me the error 'java' is not recognized as an internal or external command, operable program or batch file.
java and javac are part of JRE and JDK 12 doesn't have JRE now, so how to setup this. please don't relate this issue with old questions, until java8 it's fine but its not working now in windows 10. 这是 JAVA_HOME

这是路径条目

命令提示符仍然显示错误

路径截图

java and javac are part of JRE and JDK 12 doesn't have JRE now, so how to setup this.

After JDK 10, there is no separate JRE shipped and you do not need a separate JRE anymore. The JDK is enough.

I am using java 12.0.2, JAVA_HOME is set as C:\Program Files\Java\jdk-12.0.2 and PATH is having %JAVA_HOME%\bin

The space in the path may cause problems. I suggest you set C:\Program Files\Java\jdk-12.0.2\bin directly into PATH . Also, make sure to promote this entry to the top (beginning) so that this entry overrides the existing Java version (if any).

Last but not the least, start a new cmd window session to check java -version because the changes in the environment variables using the GUI does not become effective in already open cmd windows.

For any misconfiguration, if you can not make it work, download a fresh JDK and follow the instructions on the download page .

Try removing any existing java paths and making sure your JAVA_HOME is correct. There is no JRE but the java command should work if your env vars are correct. It is most likely a configuration error so deleting old configuration and reconfiguring will probably hlep.

The problem was caused by Python which was not allowing to execute java/javac commands. Once I uninstall the python everything worked fine.

I am still not sure what happened when I install Python as I explicitly didn't do anything except enabling the tick mark to setup the path variable while installing it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM