eclipse 错误:无法运行程序“jar”:CreateProcess error=2,系统找不到指定的文件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7291442/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 20:29:57  来源:igfitidea点击:

Error: Cannot run program "jar": CreateProcess error=2, The system cannot find the file specified

eclipseblackberryjava-mejar

提问by jeevamuthu

When I run my BlackBerry project in Eclipse, I get the following error:

当我在 Eclipse 中运行我的 BlackBerry 项目时,出现以下错误:

Error: Cannot run program "jar": CreateProcess error=2, The system cannot find the file specified

错误:无法运行程序“jar”:CreateProcess error=2,系统找不到指定的文件

How is this caused and how can I solve it?

这是怎么引起的,我该如何解决?

采纳答案by prinujith

you can solve this problem by following setting

您可以通过以下设置解决此问题

Right Click My Computer -> Select Properties-> Select AdvancedSystem Settings Tab -> Environment variables Click on new button and Add

右键单击我的电脑-> 选择属性-> 选择高级系统设置选项卡-> 环境变量单击新按钮并添加

Variable Name : JAVA_HOMEVariable Value : C:\Program Files\Java\jdk1.7.0\

变量名称:JAVA_HOME变量值:C:\Program Files\Java\jdk1.7.0\

note jdk not jre

注意 jdk 不是 jre

回答by jeevamuthu

Finally I get the solution .copy the jar.exe from java bin folder and paste to the jre bin folder.

最后我得到了解决方案。从 java bin 文件夹复制 jar.exe 并粘贴到 jre bin 文件夹。

回答by Oliv Utilo

I tried several of the posted methods, the important step seemed to be setting the correct system path (the "Path" environmental variable) to have included a folder that pointed to the relevant jar.exe. The variable changed from Xto X+ ;C:\Program Files\Java\jdk1.7.0_03\bin; you need to make sure the jdkfolder part is relevant to your version, which I overlooked.

我尝试了几种已发布的方法,重要的一步似乎是设置正确的系统路径(“路径”环境变量)以包含一个指向相关 jar.exe 的文件夹。从改变了可变XX+ ;C:\Program Files\Java\jdk1.7.0_03\bin; 您需要确保jdk文件夹部分与您的版本相关,我忽略了这一点。

The reason for my answer is to add the step I missed; which is to restart Eclipse! I tried running it a few times, but after closing and reopening it the project packaged correctly. It might not have been obvious to do this.

我的回答的原因是添加了我遗漏的步骤;也就是重启Eclipse!我尝试运行它几次,但在关闭并重新打开它后,项目打包正确。这样做可能并不明显。

回答by Gargi

  1. Set the Environment variable correctly (under path set till jdk->bin)
  2. In your Eclipse Installed JREs make sure you are pointing till JDK folder and not JRE
  1. 正确设置环境变量(在路径设置下直到 jdk->bin)
  2. 在 Eclipse Installed JRE 中,确保指向 JDK 文件夹而不是 JRE

回答by Govindarao Kondala

i think you need to set jarfile path.

我认为您需要设置 jarfile 路径。

回答by Michael Donohue

From the BlackBerry Support Forums:

来自 BlackBerry支持论坛

first thing is to check that the JDK is installed, and that the PATH is set correctly. Open a command line window, and run the "jar" command.

首先是检查是否安装了 JDK,以及是否正确设置了 PATH。打开命令行窗口,然后运行“jar”命令。

回答by ZeZNiQ

Adding C:\Program Files\Java\jdk1.8.0_131 to JAVA_HOME and C:\Program Files\Java\jdk1.8.0_131\bin to Path in System Variables within Environment Variables wasn't sufficient.

将 C:\Program Files\Java\jdk1.8.0_131 添加到 JAVA_HOME 和 C:\Program Files\Java\jdk1.8.0_131\bin 到环境变量中系统变量的路径是不够的。

Turns out, you need to add those two variables and their respective values to both user and system variables within environment variables.

事实证明,您需要将这两个变量及其各自的值添加到环境变量中的用户和系统变量中。

I added the following to BOTH User variables as well as System variables in Environment Variables: Variable: JAVA_HOME Value: C:\Program Files\Java\jdk1.8.0_131

我将以下内容添加到环境变量中的用户变量和系统变量:变量:JAVA_HOME 值:C:\Program Files\Java\jdk1.8.0_131

Variable: Path Value: C:\Program Files\Java\jdk1.8.0_131\bin

变量:路径值:C:\Program Files\Java\jdk1.8.0_131\bin

That worked for me !

这对我有用!

回答by bikash_binay

This error comes because of Jdk1.7. So try 1.6 and set path to bin folder.

这个错误是因为 Jdk1.7。所以尝试 1.6 并将路径设置为 bin 文件夹。

It works for me...

这个对我有用...

回答by AdnanJT

I was developing an app for BB JDE 5.0 and I had the java JDK 1.7. I was going crazy because I tough everything was ok. Then I realize that for JDE 5.0 I needed JDK 1.6. Installed it from here Java SE Development Kit 6 Update 45changed the environment path and my problem was solved!. :)

我正在为 BB JDE 5.0 开发一个应用程序,我有 java JDK 1.7。我快疯了,因为我坚持一切都很好。然后我意识到对于 JDE 5.0 我需要 JDK 1.6。从这里安装Java SE Development Kit 6 Update 45更改了环境路径,我的问题解决了!。:)

回答by Jav T

The Solution is: Open My computer, right click > select properties > go to advanced > go to System environment variables > under PATH add this one:

解决方案是:打开我的电脑,右键单击>选择属性>转到高级>转到系统环境变量>在PATH下添加这个:

c:/Program Files/Java/jdk1.7.0_03/bin

c:/Program Files/Java/jdk1.7.0_03/bin

Close and reopen Eclipse and thats it...

关闭并重新打开 Eclipse,就是这样......

NOTE: jdk1.7.0... is for the java version you have installed on your computer

注意:jdk1.7.0... 适用于您计算机上安装的 java 版本