“Java"未被识别为内部或外部命令 [英] 'Java' is not recognized as an internal or external command

查看:38
本文介绍了“Java"未被识别为内部或外部命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在尝试检查我正在运行的 Java 的当前版本时,我收到错误java 未被识别为内部或外部命令、可运行的程序或批处理文件.".

When trying to check the current version of Java in which I am running, I received the error "java is not recognized as an internal or external command, operable program or batch file.".

我正在运行 Windows 7 操作系统并下载了最新的 JDK,但我觉得我可能不小心从机器中删除了 java,就像之前我能够使用命令java -version"检查 Java 版本一样.

I am running Windows 7 OS and have downloaded the latest JDK and felt I may have accidentally deleted the java from machine as before I was able to check the Java version using the command "java -version".

我必须下载什么软件才能让 Java 再次在我的机器上运行?

What software must I download to get Java working on my machine again?

在确保所有环境变量都指向当前的 Java SDK 后,我已经设法从我的 cmd 中再次运行 Java.

I have managed to get Java running from my cmd again after ensuring all environment variables pointed to the current Java SDK.

推荐答案

你需要配置你的环境变量,JAVA_HOMEPATH.

You need to configure your environment variables, JAVA_HOME and PATH.

JAVA_HOME 必须包含java的路径,并且你应该将%JAVA_HOME%in添加到PATH

JAVA_HOME must contain the path to java, and you should add %JAVA_HOME%in to PATH

或者,您可以简单地将 bin 文件夹的整个路径添加到您的 PATH 中,而无需 JAVA_HOME 变量,但是,当您需要时,这会变得有点烦人在你的机器上有一个以上的 java 版本(这样你只需要改变 JAVA_HOME 甚至不用操心 PATH)

Alternatively, you can simply add to your PATH the whole path to the bin folder, without the JAVA_HOME variable, however, this makes a little more annoying when you need to have more than one java version on your machine (that way you only need to change JAVA_HOME and don't even bother with PATH)

这篇关于“Java"未被识别为内部或外部命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆