I have created several projects using eclipse and java. Each of these projects has a runnable .jar file. I would like to create one java program which would call each of my .jar files, kind of like a batch sequential system where one jar file would execute only after the previous one has completed.
Expand|Select|Wrap|Line Numbers
- public static void main(String[] args) {
- call jar file 1
- call jar file 2
- call jar file 3
- }
call jar file 4
I have tried google but the examples there do not seem to be working on my machine. This is what i have tried:
Expand|Select|Wrap|Line Numbers
- ProcessBuilder builder = new ProcessBuilder("java -jar A.jar");
- Process process = builder.start();
Cannot run program "java -jar A.jar": CreateProcess error=2, The system cannot find the file specified
i have googled this error and this error refers to the environment path. I have verified this and my environment path points to the right location.
any ideas?
this is what's in my Environment Path:
C:\Program Files\Java\jdk1.6.0_25\jre\bin\;C:\Program Files\Java\jre6\bin\;C:\Program Files (x86)\SSH Secure Shell;
and this is whats in my class path:
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\Sy stem32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShel l\v1.0\;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files\Java\jdk1.6.0_25\jre\bin\;C:\Program Files\Java\jre6\bin\;C:\Program Files\TortoiseSVN\bin;
thank you!