简体   繁体   English

java 命令在 CMD 中不返回任何内容

[英]java command no returning anything in CMD

I just installed the JDK for 15.0.2 and added the bin to my path.我刚刚为 15.0.2 安装了 JDK,并将 bin 添加到我的路径中。 When I type java in the command prompt, nothing happens.当我在命令提示符下键入 java 时,没有任何反应。 Can anyone help?谁能帮忙?

This issue might happen when if you have multiple versions of jdk on your machine and removed one of them, or if the installation went wrong.如果您的计算机上有多个版本的 jdk 并删除其中一个,或者安装出错,则可能会发生此问题。 To solve this issue just make sure of two things:要解决此问题,只需确保两件事:

  1. "{path to jdk}\bin" is added to your path. “{jdk 路径}\bin”已添加到您的路径中。 usually path is "C:\Program Files\Java\jdk-13.0.2\bin" like that.通常路径是这样的“C:\Program Files\Java\jdk-13.0.2\bin”
  2. Make sure that Path variable in System variables has the variable "C:\Program Files\Common Files\Oracle\Java\javapath"确保系统变量中的 Path 变量具有变量“C:\Program Files\Common Files\Oracle\Java\javapath”

If all is set, then you have come to the most important step that will fix the issue.如果一切就绪,那么您已经到了解决问题的最重要步骤。 Navigate to "C:\Program Files\Common Files\Oracle\Java\javapath" , there you will find java.exe, javac.exe..etc.导航到“C:\Program Files\Common Files\Oracle\Java\javapath” ,您会在那里找到 java.exe、javac.exe 等。 now copy the java.exe from {path to jdk}\bin to this folder.现在将 java.exe 从{path to jdk}\bin复制到此文件夹。 do the same with the rest of executables found in "C:\Program Files\Common Files\Oracle\Java\javapath" folder.“C:\Program Files\Common Files\Oracle\Java\javapath”文件夹中的 rest 可执行文件执行相同操作。

This solved the problem for me, hope it helps.这为我解决了问题,希望对您有所帮助。

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

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