简体   繁体   中英

PowerShell term not recognized

I added a JAVA_HOME environment variable and added an entry to the PATH in Windows 10 so I could run Bamboo Server on my machine. In PowerShell I can not use java -version I get an error, but the same command works fine in CMD.

error message in PowerShell

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
...

the variables

JAVA_HOME="C:\PROGRA~2\Java\jdk1.8.0_211"
PATH=...%JAVA_HOME%\bin

For this to work with PowerShell remove the double-quotes in the JAVA_HOME variable.

working variables

JAVA_HOME=C:\PROGRA~2\Java\jdk1.8.0_211
PATH=...%JAVA_HOME%\bin

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM