简体   繁体   English

'java' 不是内部或外部命令、可运行程序或批处理文件

[英]'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. 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. javajavacJRE的一部分,而JDK 12现在没有JRE ,那么如何设置它。 please don't relate this issue with old questions, until java8 it's fine but its not working now in windows 10.请不要将此问题与旧问题联系起来,直到 java8 很好,但它现在在 windows 10 中不起作用。 这是 JAVA_HOME

这是路径条目

命令提示符仍然显示错误

路径截图

java and javac are part of JRE and JDK 12 doesn't have JRE now, so how to setup this. java 和 javac 是 JRE 的一部分,而 JDK 12 现在没有 JRE,那么如何设置它。

After JDK 10, there is no separate JRE shipped and you do not need a separate JRE anymore.在 JDK 10 之后,不再提供单独的 JRE,您也不再需要单独的 JRE。 The JDK is enough. JDK就够了。

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我正在使用 java 12.0.2,JAVA_HOME 设置为 C:\Program Files\Java\jdk-12.0.2 和 PATH 有 %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 .我建议您将C:\Program Files\Java\jdk-12.0.2\bin直接设置为PATH Also, make sure to promote this entry to the top (beginning) so that this entry overrides the existing Java version (if any).此外,请确保将此条目提升到顶部(开头),以便此条目覆盖现有的 Java 版本(如果有)。

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. 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 .对于任何错误配置,如果您无法使其正常工作,请下载新的 JDK 并按照下载页面上的说明进行操作

Try removing any existing java paths and making sure your JAVA_HOME is correct.尝试删除任何现有的 java 路径并确保您的 JAVA_HOME 正确。 There is no JRE but the java command should work if your env vars are correct.没有 JRE,但如果您的环境变量正确,则 java 命令应该可以工作。 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.该问题是由不允许执行 java/javac 命令的 Python 引起的。 Once I uninstall the python everything worked fine.一旦我卸载 python 一切正常。

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.我仍然不确定当我安装 Python 时发生了什么,因为我明确地没有做任何事情,除了在安装时启用刻度线来设置路径变量。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 VSCode 'java' 不是内部或外部命令,也不是可运行的程序或批处理文件 - VSCode 'java' is not recognized as an internal or external command, operable program or batch file 错误 -'javac' 不是内部或外部命令,也不是可运行的程序或批处理文件 - Error -'javac' is not recognized as an internal or external command, operable program or batch file 'cmd'未被识别为内部或外部命令,可操作程序或批处理文件 - 'cmd' is not recognized as an internal or external command, operable program or batch file 错误 - jar 不是内部或外部命令、可运行的程序或批处理文件 - Error - jar is not recognized as an internal or external command, operable program or batch file 'jar' 不是内部或外部命令、可运行程序或批处理文件错误 - 'jar' is not recognized as an internal or external command, operable program or batch file error 'appletviewer' 不是内部或外部命令,也不是可运行的程序或批处理文件 - 'appletviewer' is not recognized as an internal or external command, operable program or batch file 'wsgen'不被识别为内部或外部命令,可操作程序或批处理文件 - 'wsgen' is not recognized as an internal or external command, operable program or batch file 'scomp' 不是内部或外部命令,也不是可运行的程序或批处理文件 - 'scomp' is not recognized as an internal or external command, operable program or batch file 'mvn' 不是内部或外部命令,也不是可运行的程序或批处理文件 - 'mvn' is not recognized as an internal or external command, operable program or batch file Hadoop '-classpath' 不是内部或外部命令,也不是可运行的程序或批处理文件 - Hadoop '-classpath' is not recognized as an internal or external command, operable program or batch file
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM