【发布时间】:2013-05-29 10:20:38
【问题描述】:
我的机器上安装了 Java(JRE 在 C:\Program Files\Java 下),但我无法从 Windows PowerShell 命令提示符运行任何 java 命令。
>>> java -version
java : The term 'java' is not recognized as the name of a cmdlet, function, script file, or operable program. Check
the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ java
+ ~~~~
+ CategoryInfo : ObjectNotFound: (java:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
但是,我注意到 Java 确实可以工作,并且我可以在旧的 Windows 命令提示符下运行 Java 命令。原来只有 PowerShell 无法运行这些命令。
我有 JRE 7,我在 Windows 8 上使用 Windows PowerShell。
【问题讨论】:
-
你在
PATH中设置了%JAVA_HOME%/bin吗? -
您需要将 Java 添加到您的系统路径中。
标签: powershell java