Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
484 views
in Technique[技术] by (71.8m points)

java - 无法将“ Java”识别为内部或外部命令('Java' is not recognized as an internal or external command)

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

(尝试检查正在运行的Java的当前版本时,收到错误“无法将Java识别为内部或外部命令,可操作程序或批处理文件”。)

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

(我正在运行Windows 7 OS,并且已经下载了最新的JDK,并觉得我可能像从前无法使用命令“ java -version”检查Java版本之前从机器上删除了Java。)

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

(我必须下载什么软件才能使Java在我的计算机上再次运行?)

EDIT:

(编辑:)

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

(确保所有环境变量都指向当前java sdk之后,我设法再次从cmd运行Java。)

Thank you for all answers to my question, Karen

(谢谢您对我的问题的所有回答,凯伦)

  ask by Karen translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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

(您需要配置环境变量JAVA_HOMEPATH 。)

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

(JAVA_HOME必须包含Java的路径,并且应将%JAVA_HOME%\ bin添加到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 )

(或者,您可以简单地将bin文件夹的整个路径添加到PATH ,而无需使用JAVA_HOME变量,但是,当您需要在计算机上使用多个Java版本时,这会更加烦人(这样一来,您只需更改JAVA_HOME ,甚至不用理会PATH ))


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...