How to run an exe file using java code?The .exe file is already there. The plan is to write a Java code for running the same. Any tutorial or reference for the same?
Try the following code:
try
{
Runtime rt = Runtime.getRuntime() ;
Process p = rt.exec("Program.exe") ;
InputStream in = p.getInputStream() ;
OutputStream out = p.getOutputStream ();
InputStream err = p.getErrorStream() ;
//do whatever you want
p.destroy() ;
}
catch(Exception exc)
{
/*handle exception*/
}