I am using the Java code to execute a bat file to make a war file by the following java code
String command = "cmd /C start C:/processFolder/paas.bat";
Runtime rt = Runtime.getRuntime();
Process pr = rt.exec(command);
which means it will execute the paas.bat file to do some jobs. There is a command within the paas.bat :
jar cfv xxx.war */ .
however, it does not jar all the file and folder into xxx.war. Does any one has the idea why this happens? Thanks!
The command uses current working directory, which will be different from java program. You may change script to do a cd and then call jar command.
Please capture output , error and exceptions(if any) from the command and add to your question.
(note#1. It may be more useful to use tools like ant to do these task. The tasks in ant can be called from java program using ant libraries..
Note#2 – Prefer ProcessBuilder to launch new process. )