Calling OS command using Java procedure in PL/SQL generates NON-EXISTANT PROCESS on NT [message #91624] |
Fri, 13 December 2002 14:54 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
Alain Labonté
Messages: 1 Registered: December 2002
|
Junior Member |
|
|
Hello, we are using a procedure called "executecmd" that is a Java procedure used to call an Operating system command (we're under NT 4.0). But when we call a batch file (Ex: test.bat), the system executes the program correctly, but let a Non-Existant Process on the server. Do you have any idea of what might cause that bug?
Here the java program :
create or replace and compile java source named executecmd as
import java.lang.Runtime;
import java.lang.Process;
import java.io.IOException;
import java.lang.InterruptedException;
class ExecuteCmd {
public static void main(String args[[]]) {
System.out.println("In main");
try {
/* Execute the command using the Runtime object and get the
Process which controls this command */
Process p = Runtime.getRuntime().exec(args[[0]]);
/* Use the following code to wait for the process to finish
and check the return code from the process */
try {
p.waitFor();
/* Handle exceptions for waitFor() */
} catch (InterruptedException intexc) {
System.out.println("Interrupted Exception on waitFor: " + intexc.getMessage());
}
System.out.println("Return code from process"+ p.exitValue());
System.out.println("Done executing");
/* Handle the exceptions for exec() */
} catch (IOException e) {
System.out.println("IO Exception from exec : " +
e.getMessage());
e.printStackTrace();
}
}
}
Thank you
|
|
|
|
|