java 如何解决错误:“jar”不是内部或外部命令、可运行的程序或批处理文件?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/43514577/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How can I solve the error : 'jar' is not recognized as an internal or external command, operable program or batch file?
提问by Code_Ninja
I'm getting the following error when I try to run the 'jar
' command in the command line on windows : 'jar' is not recognized as an internal or external command
.
我收到以下错误,当我尝试运行“jar
在Windows命令行”命令:'jar' is not recognized as an internal or external command
。
There is a general guess that seems to be right that is I might have the PATH
environment variable incorrectly. But I have already done this, I added the following value to PATH
variable : 'C:\Program Files(x86)\Java\jdk1.8.0_25\bin
'.
有一个普遍的猜测似乎是正确的,即我可能PATH
错误地设置了环境变量。但是我已经这样做了,我在PATH
变量中添加了以下值:' C:\Program Files(x86)\Java\jdk1.8.0_25\bin
'。
I am running a 64 bit windows 8 system. I have also referenced this question from the following link: java 'jar' is not recognized as an internal or external command
我正在运行 64 位 Windows 8 系统。我还从以下链接中引用了这个问题: java 'jar' is notknowledge as an internal or external command
I have also tried some of the solutions suggested in the above link, I couldnt add a comment there since my reputation is not much.
我也尝试了上面链接中建议的一些解决方案,我无法在那里添加评论,因为我的声誉并不高。
Suggestions that I have tried from the above link:
我从上面的链接中尝试过的建议:
[1]https://stackoverflow.com/a/29180681/7639034
[1] https://stackoverflow.com/a/29180681/7639034
(From the above link, java -version and java -jar are also working. What is wrong with the jar file then?)
(从上面的链接,java -version 和 java -jar 也可以工作。那么 jar 文件有什么问题?)
回答by Pradeep Simha
Path variable should be pointing to bin
folder, that's where executable are stored. Currently you are having path only upto C:\Program Files(x86)\Java\jdk1.8.0_25
so you are getting error.
路径变量应该指向bin
文件夹,这是存储可执行文件的地方。目前您只有 upto 路径,C:\Program Files(x86)\Java\jdk1.8.0_25
因此您会收到错误消息。
Create JAVA_HOME
environment variable which points to above location, and add %JAVA_HOME%\bin
to PATH
variable. It will work.
创建JAVA_HOME
指向上述位置的环境变量,并添加%JAVA_HOME%\bin
到PATH
变量中。它会起作用。
回答by Nadav Tasher
try
尝试
java -jar [YOURJAR]
this should work to execute jars
这应该可以执行 jars