首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > J2EE开发 >

java调用dos命令解决办法

2013-10-21 
java调用dos命令import java.io.IOExceptionpublic class Te {/** * @param args * @throws IOException*

java调用dos命令

import java.io.IOException;


public class Te {

/**
 * @param args
 * @throws IOException 
 * @throws IOException 
 * @throws InterruptedException 
 */
public static void main(String[] args) throws IOException, InterruptedException {
// TODO Auto-generated method stub
Process process = Runtime.getRuntime().exec("cmd.exe  dir"); 
process.waitFor( );
}
}

我这个程序为什么运行到process.waitFor();就会卡住,如何解决
[解决办法]
  Process process = Runtime.getRuntime().exec("cmd.exe /c start dir");

热点排行