简体   繁体   中英

'java' is not recognized as an internal or external command, operable program or batch file in Windows 10

I know this is a popular question on the web, but I'm getting this error even after setting JAVA_HOME env variable and adding %JAVA_HOME%\bin\ to the Path variable.

I'm trying to use PDF Presenter app which requires Java. So, I downloaded Oracle JDK ( jdk-14.0.1_windows-x64_bin.exe ) and installed it and then configured the above two variables.

If I enter %JAVA_HOME%\bin\java.exe --version , it works fine. But if I enter java.exe or java , I get the error in the title. How can I fix this?

Here is the output of echo %PATH%

C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files\Git\cmd;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files\MiKTeX 2.9\miktex\bin\x64\;%JAVA_HOME%\bin\;C:\Users\Nagabhushan\AppData\Local\Microsoft\WindowsApps;

If you use the gui of windows for env variable don't use %JAVA_HOME% but the real path. The variable are not interpreted in the gui.

And in consequence you have %JAVA_HOME% directly in your path who will not be interpreted when you enter your command

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