问题
I have large number of class files , with field managers.I am getting this error Re: I/O Error: Cannot run program "jar": CreateProcess error=2, The system cannot find the file specified, on running the app.If i am excluding some classes it works fine for me ..Please suggest me how to resolve this error .
回答1:
I have experienced the exact same issue with a project that contained a lot of classes. Due to the increase in the number of classes, the java jar file moves away from the root which causes issues in compiling.
I was lucky to resolve this error. This link has been very helpful from BlackBerry Support Forums. The following steps resolved my issue:
- Right Click My Computer. Go To Properties.
- Click Advanced System Settings.
- Click Environment Variable
- Highlight PATH and click Edit. Add C:\Program Files (x86)\Java\jdk1.6.0_26\bin; to the start of the PATH.
Step 4 adds the java jar file to the PATH variable and adds it closer to the root. Adding closer to the root is helpful when compiling a project with several classes.
回答2:
The number of classes may not the issue. This may be caused by the BlackBerry packager not finding jar.exe.
The default C:\ProgramData\Oracle\Java\javapath is prepended to the PATH environment variable on Windows. This ‘javapath’ doesn’t seem to exist on in the File Explorer but can be seen in the (cygwin) shell. This directory only contains symlinks for java.exe, javaw.exe and javaws.exe but not jar.exe.
The previous answer is the correct solution and worked for me. Changing the PATH Environment Variable to prepend to the location of the JDK rather than ‘javapath’ or the JRE would allow Eclipse to find to the jar executable.
来源:https://stackoverflow.com/questions/17541630/blackberry-error-cannot-run-program-jar-createprocess-error-2-the-system-ca