O
O.B.
I'm having an odd problem in trying to get the "unzip" utility to
execute without locking up the Java process. In the code below, the
runtime.exec command successfully executes but the process.wairFor()
loop locks up about halfway through the zip file extraction process.
Help?
public static void installJboss(String installDir) {
//
// Only copy files if JBoss not installed. Check this
// by searching for jbossDir/bin/run.jar
//
String result = "";
if ( !(new File(installDir + "/bin/run.jar")).exists() ) {
//
// Extract files
//
File jbossDir = new File(installDir);
if ( !jbossDir.exists()) {
jbossDir.mkdirs();
}
String command =
"utilities/bin/unzip.exe utilities/archives/jboss-4.0.2.zip -d "
+ jbossDir.getAbsolutePath();
Runtime runtime = Runtime.getRuntime();
try {
Process process = runtime.exec(command);
process.waitFor();
if (0 != process.exitValue()) {
result = "Failed to execute: " + command;
}
} catch (InterruptedException e) {
// Ignore
} catch (IOException e) {
result = "Failed to execute: " + command;
}
}
return result;
}
execute without locking up the Java process. In the code below, the
runtime.exec command successfully executes but the process.wairFor()
loop locks up about halfway through the zip file extraction process.
Help?
public static void installJboss(String installDir) {
//
// Only copy files if JBoss not installed. Check this
// by searching for jbossDir/bin/run.jar
//
String result = "";
if ( !(new File(installDir + "/bin/run.jar")).exists() ) {
//
// Extract files
//
File jbossDir = new File(installDir);
if ( !jbossDir.exists()) {
jbossDir.mkdirs();
}
String command =
"utilities/bin/unzip.exe utilities/archives/jboss-4.0.2.zip -d "
+ jbossDir.getAbsolutePath();
Runtime runtime = Runtime.getRuntime();
try {
Process process = runtime.exec(command);
process.waitFor();
if (0 != process.exitValue()) {
result = "Failed to execute: " + command;
}
} catch (InterruptedException e) {
// Ignore
} catch (IOException e) {
result = "Failed to execute: " + command;
}
}
return result;
}