Hi Friends,
I am using Runtime class in my application.It creates JAR & EAR Files.For that I used Runtime class.
Here my peace of code Pls help me what is worng in this code.
try {
String stmt = "jar -Mcvf " + ejbJarName + " META-INF/MANIFEST.MF " +" META-INF/ejb-jar.xml " + " com";
Process stmtProcess = java.lang.Runtime.getRuntime().exec(stmt);
if (osname.startsWith("Windows")) {
System.out.println("use Thread.sleep(" + ntdepltime + ")");
Thread.sleep(100000);
try
{
stmtProcess.exitValue();
}catch(IllegalThreadStateException exp){ System.out.println("Madhu exception "+exp); }
} else {
System.out.println("use waitFor()");
stmtProcess.waitFor();
}
stmt = "jar -Mcvf " + newEarName + " META-INF/MANIFEST.MF " +" META-INF/application.xml " + ejbJarName + " " + clientJarName;
stmtProcess = java.lang.Runtime.getRuntime().exec(stmt);
if (osname.startsWith("Windows")) {
System.out.println("use Thread.sleep(" + ntdepltime + ")");
Thread.sleep(100000);
} else {
System.out.println("use waitFor()");
stmtProcess.waitFor();
}
} catch (Exception e) {
e.printStackTrace();
}
After JAR file creatation execution it is throwing java.lang.IllegalThreadStateException exception.
Pls help me in this regard.
thanks,
Madhu