Java 如何知道我机器上的jdk版本?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/57363446/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-11 01:18:46  来源:igfitidea点击:

How to know the jdk version on my machine?

javajava-8

提问by Mayank Kataria

I have recently uninstalled JDK 11and installed JDK 8. For confirmation, I want to check which JDK is installed on my Windows 10machine. I typed java -versionon cmd then get the error message

我最近卸载了JDK 11并安装了JDK 8。为了确认,我想检查我的Windows 10机器上安装了哪个 JDK 。我输入java -versioncmd 然后收到错误消息

java is not recognized as an internal or external command

java 不被识别为内部或外部命令

Question:How to know which JDK version installed on pc?

问题:如何知道电脑上安装了哪个JDK版本?

采纳答案by ganga

you might need to add pathin environment variables which you can find in Control Panelopen the Jdkwhere you installed and add until /binin the path in environment variables.

您可能需要添加path环境变量,您可以在控制面板中找到这些变量, 打开安装的Jdk并添加到/bin环境变量的路径中。

Add until /binin path variable in System Variableswhich is residing in Environment Variables.

添加到/bin在PATH变量系统变量这是居住在环境变量

Then do java -versionwhich might show up.

然后做 java -version哪些可能会出现。

If still problem persists, try restarting your pc and see.

如果问题仍然存在,请尝试重新启动您的电脑并查看。

回答by tarik

You need to update your Windows pathto include your %JAVA_HOME%\bindirectory. %JAVA_HOME%is the directory that you installed Java into and is also an environment variable that you need to configure for command line execution of your applications. You can edit both of these in the Windows control panel and you should restart.

您需要更新您的 Windowspath以包含您的%JAVA_HOME%\bin目录。%JAVA_HOME%是您安装 Java 的目录,也是您需要为应用程序的命令行执行配置的环境变量。您可以在 Windows 控制面板中编辑这两个,然后重新启动。

When you run java -versionyou will see the internal version number. This is explained here: https://en.wikipedia.org/wiki/Java_version_history.

当您运行时,java -version您将看到内部版本号。这在这里解释:https://en.wikipedia.org/wiki/Java_version_history

Basically, you can ignore the 1.when reading version number. The _xxxis a reference to the most recent patch or build release.

基本上,您可以1.在阅读版本号时忽略。该_xxx是到最近的补丁或建立版本的参考。