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

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

问题描述

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



但是当我去命令提示符检查版本时,它说它不被识别。



是否有其他人遇到此问题与最新的Java?



我可能没有安装正确的版本。我需要与 grails 一起工作的java。

  C:\> java 
'java'不被识别为内部或外部命令,
可操作程序或批处理文件。

C:\> java -version
'java'不被识别为内部或外部命令,
可操作程序或批处理文件。

C:\>

当我在我的计算机上搜索java时,它找不到任何内容

解决方案

Windows 2k8 R2服务器 -
要在命令行中使用java [-option]或%JAVA_HOME%,您需要以下:



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



编辑路径变量并添加;在最后一个值之后并将路径添加到Java bin目录中:
eg- C:\Progra〜2 \Java\jre6\bin\

将JAVA_HOME变量的值设置为java可执行文件的路径:
eg- C:\Progra〜2 \Java\jre6\bin\java.exe


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.

Is anyone else experiencing this issue with the latest Java?

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:\>

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

解决方案

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

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~2\Java\jre6\bin\

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

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

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