Toolkit.getRunTime().exec("C:/a.exe");

解决方案 »

  1.   

    Runtime.getRuntime().exec("cmd /c start C://test");
      

  2.   

    Runtime.getRuntime().exec("cmd /c start C://a.exe");
      

  3.   

    不行的。
    public class Exe{

    public static void main(String args[]){

    Runtime.getRuntime().exec("C://WinMD5.exe");

    }


    }errorF:\javastudy\Exe.java:6: unreported exception java.io.IOException; must be caught or declared to be thrown
    Runtime.getRuntime().exec("C://WinMD5.exe");
                                      ^
      

  4.   

    你的用try{}catch(IOException id){}来捕获异常才行的。
      

  5.   

    public class Exe{

    public static void main(String args[]){

    //必须要用try语句
    try{
    Runtime.getRuntime().exec("D:\\PQwak.exe");
    }
    catch(Exception e){
    System.out.println("error");
    }
    }


    }