“java -version"不在命令提示符下工作 [英] "java -version" not working in command prompt

查看:31
本文介绍了“java -version"不在命令提示符下工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我下载了这个 Java JDK 并安装了它.

I downloaded this Java JDK and installed it.

但是当我去命令提示符检查版本时,它说它无法识别.

But when I go to the command prompt to check the version, it says it's not recognized.

是否还有其他人在使用最新的 Java 时遇到此问题?

Is anyone else experiencing this issue with the latest Java?

我可能没有安装正确的版本.我需要与 grails

I might not have installed the right version. I need the java that works with grails

C:>java
'java' is not recognized as an internal or external command,
operable program or batch file.

C:>java -version
'java' is not recognized as an internal or external command,
operable program or batch file.

C:>

当我在我的电脑上搜索 java 时,它没有找到任何东西

when i do a search on my computer for java, it does not find anything

推荐答案

Windows 2k8 R2 server-要使 java [-option] 或 %JAVA_HOME% 在命令行中工作,您需要以下内容:

Windows 2k8 R2 server- For both java [-option] or %JAVA_HOME% to work in the command line you need the following:

在控制面板->系统和安全->系统->高级系统设置->高级->环境变量->系统变量

In Control Panel->System and Security->System->Advanced system setting->Advanced->Environment Variables->System Variables

编辑Path变量并添加一个;"在最后一个值之后并添加 Java bin 目录的路径:例如- C:Progra~2Javajre6in

Edit the Path variable and add a ";" after the last value and add the the path to the Java bin directory: e.g.- C:Progra~2Javajre6in

添加 JAVA_HOME 变量,其值设置为 java 可执行文件的路径:例如- C:Progra~2Javajre6injava.exe

Add the JAVA_HOME Variable with the value set to the path for the java executable: e.g.- C:Progra~2Javajre6injava.exe

这篇关于“java -version"不在命令提示符下工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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