I'm trying to run windows commands by using java code, but code is not working and giving exception error. Following is the code
import java.io.*;
public class run_command
{
public static void main(String args[])
{
try
{
String command = "start firefox";
Process process = Runtime.getRuntime().exec(command);
}
catch(IOException e){ System.out.println(e); }
}
}
And following is the exception error
java.io.IOException: Cannot run program "start firefox": Create Process error=2, The system cannot find the file specified.
This error is occurring for every windows commands. Please suggest some solution on this. thanks.