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

11

20

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

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

How is this caused and how can I solve it?

Triplett answered 3/9, 2011 at 5:56 Comment(1)
This link gives some hints. Which have you already tried?Brooklet
R
11

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_HOME Variable Value : C:\Program Files\Java\jdk1.7.0\

note jdk not jre

Rodolphe answered 26/3, 2012 at 9:7 Comment(1)
The problem, at least in my case, was that JAVA_HOME was pointing to the JRE (where there is no jar.exe in the "bin folder) and not to the JDK where the jar.exe resides in its bin folder. JAVA_HOME must point to the JDK root folder, not the bin folder. The "bin" folder you may add to the path but not required.Kuban
T
12

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

Triplett answered 23/9, 2011 at 5:40 Comment(1)
This is not a solution. You have to set the ENV variables correctly. More information here docs.oracle.com/javase/tutorial/essential/environment/…Marijuana
R
11

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_HOME Variable Value : C:\Program Files\Java\jdk1.7.0\

note jdk not jre

Rodolphe answered 26/3, 2012 at 9:7 Comment(1)
The problem, at least in my case, was that JAVA_HOME was pointing to the JRE (where there is no jar.exe in the "bin folder) and not to the JDK where the jar.exe resides in its bin folder. JAVA_HOME must point to the JDK root folder, not the bin folder. The "bin" folder you may add to the path but not required.Kuban
C
9

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 X to X + ;C:\Program Files\Java\jdk1.7.0_03\bin; you need to make sure the jdk folder part is relevant to your version, which I overlooked.

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.

Cruise answered 26/3, 2012 at 10:56 Comment(1)
You need to restart Eclipse, because its process' environment variables are set at startup time. Modifying the system variables will affect processes that are subsequently created.Diabolism
E
2

i think you need to set jarfile path.

Echino answered 3/9, 2011 at 7:19 Comment(1)
Finally I get the solution .copy the jar.exe from java bin folder and paste in the jre bin folder.Triplett
S
2

From the BlackBerry Support Forums:

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.

Severini answered 4/9, 2011 at 12:56 Comment(0)
M
2
  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
Mikael answered 22/11, 2012 at 11:32 Comment(0)
D
1

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

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

Close and reopen Eclipse and thats it...

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

Dinny answered 11/7, 2012 at 19:16 Comment(0)
O
1

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

It works for me...

Olag answered 11/12, 2012 at 11:33 Comment(0)
T
1

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 45 changed the environment path and my problem was solved!. :)

Trilinear answered 2/6, 2013 at 0:1 Comment(0)
E
1

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.

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

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

That worked for me !

Eightieth answered 18/7, 2017 at 18:5 Comment(0)
E
0

This worked for me: Project JDE 5.0 OS: Windows 8.1 x64

This PC > Properties > Advanced System Settings > Environment Variables: Added the following: Path: C:\Program Files (x86)\Java\jdk1.7.0_25\bin;C:\Program Files (x86)\Java\jdk1.7.0_17\bin;C:\Program Files (x86)\Java\jre7\bin

I know the above is similar but thought id post what worked for me anyway as it reinforces the above answers :)

NB to restart eclipse.

Eidson answered 23/9, 2014 at 7:29 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.