调用其他的可执行文件,例如:自己制作的exe,或是下载安装的软件

public void RunBat(String filepath)throws Exception{
        String str=filepath+"execute.bat";
        try{
            Process p=Runtime.getRuntime().exec(str);
            InputStream in=p.getInputStream();
            int c;
            while((c=in.read())!=-1){
                System.out.print(c);
            }
            in.close();
            p.waitFor();
        }catch(Exception e){
            e.printStackTrace();
        }
    }
posted on 2007-05-10 13:52  王永庆  阅读(517)  评论(0编辑  收藏  举报