Possible Duplicate:
Running a .exe file using Java
How can i run a .exe file from my java Program ?
Is it possible ?
Possible Duplicate:
Running a .exe file using Java
How can i run a .exe file from my java Program ?
Is it possible ?
U can use the following code.........
Runtime rt = Rintime.getRuntime() ;
Process p => rt.exec("Program.exe") ;
Use this code
try
{
Runtime r = Runtime.getRuntime();
Process p2 = r.exec("a.exe"); //absolute or relative path
}
catch(IOExeption ex)
{
System.out.println(ex.getMessage());
}
If you have the privileges, you can run OS's commands with this:
String cmd = "c:/full/path/to/myCommand.exe";
Runtime run = Runtime.getRuntime();
Process pr = run.exec(cmd);
import java.io.IOException;
public class ExeRunner
{
public static void main(String args[]) throws IOException
{
ProcessBuilder proc = new ProcessBuilder("<your_exe>", "exe_args");
proc.start();
}
}