import java.io.;
import java.lang.;
import java.util.;
import java.sql.;
import oracle.sql.*;
publicclass jv_run_extpro
{
publicstaticvoid run(String cmd) throws IOException
{
Process p=Runtime.getRuntime().exec(cmd);
StreamGobbler errorGobbler = new StreamGobbler(p.getErrorStream(),"Error");
StreamGobbler outputGobbler = new StreamGobbler(p.getInputStream(),"Output");
errorGobbler.start();
outputGobbler.start();
try
{
p.waitFor();
}
catch(InterruptedException ie)
{
System.out.println(ie);
}
}
publicstaticclass
StreamGobbler extends Thread {
InputStream is;
String type;
public StreamGobbler(InputStream is,String type) {
this.is = is;
this.type = type;
}
publicvoid run() {
try {
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
String line = null;
while ((line = br.readLine()) != null) {
if (type.equals("Error")) {
System.out.println("Error :" + line);
} else {
System.out.println("Debug:" + line);
}
}
} catch (IOException ioe) {
ioe.printStackTrace();
}
}
}
}