Click to See Complete Forum and Search --> : Running External Programs using a Java Program


Decoy-Boy
10-11-2003, 02:46 PM
Hey there, I was wondering how I would go about running an external program (like any .exe file) using one of my own Java programs. It must be simple, I just can't figure out the code. Thanx

Khalid Ali
10-11-2003, 04:30 PM
I don't think you can do that using JavaScript,however if you want java to run programs thats piece of cake
read up on
RunTime class
below is an example code snippet that will launch notepate

try{
Runtime runtime = Runtime.getRuntime();
process = runtime.exec("notepad.exe");
}catch (IOException ioe){
ioe.printStackTrace();
}

Decoy-Boy
10-11-2003, 04:45 PM
Thanx, I think my biggest problem was that I did not know what to call it. But now I know wherer to start looking, thanx again.

Khalid Ali
10-11-2003, 04:54 PM
you are welcome;)