Java运行外部程序-_-!...

// 几行代码我就不解释啦!

import  java.lang.Runtime;
import  java.io.IOException;

public class runCmd {
    
    public static void main(String[] args) {
    try{
    Runtime.getRuntime().exec("cmd.exe /c start cmd.exe");
    }
    catch(IOException e){
    System.out.println("运行cmd程序时出现错误!\n"+e.toString());
    }
    System.out.println("Hello World!");
    }
}

posted @ 2011-12-18 15:18  氺〤魚Oo。  阅读(149)  评论(0编辑  收藏  举报