Runtime.getRuntime().exec("sb.exe","sb.in");

解决方案 »

  1.   

    public executeExe()
    {
    ....
    Runtime.getRuntime().exec("sb.exe","sb.in");
    .....
    }
    public readFile()
    { int b;
      byte buffer[]=new byte[2500];
      try{ FileInputStream readfile=new FileInputStream("sb.out");
           b=readfile.read(buffer,0,2500);
           try { String str=new String(buffer,0,b,"Default");
                 System.out.println(str);
               }        
           catch(UnsupportedEncodingException e)
               { System.out.println(" the encoding was not found:"+e);
               }
         }
       catch(IOException e)
         {System.out.println("File read Error ");
         }
      }
    }
      

  2.   

    Runtime.getRuntime().exec("sb.exe","sb.in");时候报错,如何解决安全问题?
      

  3.   

    你要捕捉異常,還有就是要注意應用程序的路徑問題,比如exec("c:\1.exe")什麼的~~~
      

  4.   

    先谢谢aiur捕捉異常还有就是一个疑问!java能让你随便调用exe文件吗?那如果我调用电源管理的不死机了?