运行 Windows cmd.exe 中的 java.exe

huangapple go评论76阅读模式
英文:

Running java.exe from Windows cmd.exe

问题

我想从我的系统中的JDK目录运行 java -jar

D:\Users\djpastis\Downloads\fmw_12.2.1.4.0_wls_Disk1_1of1>C:\Program Files\Java\jdk1.8.0_162\bin\java

但是我遇到了这个错误,即使路径是正确的:

'C:\Program' 被识别为内部或外部命令、可执行程序或批处理文件的命令。

英文:

I want to run java -jar from the JDK directory on my system:

D:\Users\djpastis\Downloads\fmw_12.2.1.4.0_wls_Disk1_1of1>C:\Program Files\Java\jdk1.8.0_162\bin\java

but I have this error, even the path is OK

'C:\Program' is not recognized as an internal or external command, operable program or batch file.

答案1

得分: 4

Paths containing special characters, such as a SPACE, must be quoted. Microsoft put a SPACE characters in there for you. 运行 Windows cmd.exe 中的 java.exe The only reliable, safe way is to always quote paths.

"%ProgramFiles%\Java\jdk1.8.0_162\bin\java.exe"
英文:

Paths containing special characters, such as a SPACE, must be quoted. Microsoft put a SPACE characters in there for you. 运行 Windows cmd.exe 中的 java.exe The only reliable, safe way is to always quote paths.

"%ProgramFiles%\Java\jdk1.8.0_162\bin\java.exe"

huangapple
  • 本文由 发表于 2020年8月18日 22:22:06
  • 转载请务必保留本文链接:https://go.coder-hub.com/63470681.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定