To call an executable file in windows from a java program you need to execute
the file using the java Runtime.
i.e. you need to call the exec() function of the Runtime defined in the API.
So for example if you would want to open internet explorer from you java program
you could just do
public class MyRuntime {
public static void main (String[] args) {
try{
Process p = Runtime.getRuntime().exec("\"C:/Program Files/Internet
Explorer/IEXPLORE.EXE\"");
p.waitFor();
} catch(java.io.IOException e) {
System.out.println(e.toString());
e.printStackTrace();
} catch(java.lang.InterruptedException ie) {
System.out.println(ie.toString());
ie.printStackTrace();
}
}
}
Now if you want to call notepad just replace the path in the exec wite
notepad.exe 's path. You need the escape sequence \" because the path contains a
white space.
Since notepad.exe is in the Path environment variable in windows you could just
do
Process p = Runtime.getRuntime().exec("notepad.exe");