我在我的机器上安装了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
Run Code Online (Sandbox Code Playgroud)
但是,我注意到Java确实有效,我可以在旧的Windows命令提示符下运行Java命令.原来它只是PowerShell,我无法运行这些命令.
我有JRE 7,我在Windows 8上使用Windows PowerShell.
进行 2 个环境变量更改:
JAVA_HOME等于以下内容的变量: C:\Java\JDK1.7.0_25_x64%JAVA_HOME%\bin到PATH变量的开头。然后,启动一个全新的 shell 以查看是否应用了更改。
将Java安装位置(bin目录)添加到PATH变量中。
;%ProgramFiles%/Java/jre%version%/bin
Run Code Online (Sandbox Code Playgroud)
跟一个 ;
注意:
%version% means the java version.
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
29528 次 |
| 最近记录: |