无法从 Windows PowerShell 命令提示符运行 Java
2022-09-04 08:17:20
我的机器上安装了Java(JRE位于),但我无法从Windows PowerShell命令提示符处运行任何java命令。C:\Program Files\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。