1. Java调用windows程序 
      Runtime ru = Runtime.getRuntime();
        try {
            //调用播放器文件播放指定MP3
            Process p1 = ru.exec("C:\\Program Files\\Windows Media Player\\wmplayer d:\\DADA\\mp3\\0197.mp3");
           //调用批处理文件 
            Process p2 = ru.exec("d:\\a.bat");

            //显示执行结果
            BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
            String line;
            while((line=br.readLine())!=null){
                System.out.println(line);
            }
        } catch (IOException ex) {ex.printStackTrace();}
posted on 2006-10-05 14:39 pear 阅读(349) 评论(1)  编辑  收藏
Comments

只有注册用户登录后才能发表评论。


网站导航: