读书人

java 调用dos命令行解决办法

发布时间: 2014-01-01 18:12:08 作者: rapoo

java 调用dos命令行
我想用java执行phantomjs,但是发现我写的不行,

public static void invokeCmd() {
try {
// Execute command
String command = "cmd /c start cmd.exe";
Process child = Runtime.getRuntime().exec(command);

// Get output stream to write from it
OutputStream out = child.getOutputStream();

out.write("cd C:\\phantomjs-1.9.2-windows /r/n".getBytes());
out.flush();
out.write("phantomjs.exe nova.js http://www.amcharts.com/fiddle/?id=amcharts/tZyTN /r/n"
.getBytes());
out.close();
} catch (IOException e) {
}
}

他就弹出了一个dos窗口,求大神帮忙 java phantomjs dos
[解决办法]
没搞过,不知道,坐等别人回答....
[解决办法]
比如我要打开D盘的qq.txe

  String command = "cmd /c start  d:qq.txt";
Process child = Runtime.getRuntime().exec(command);

[解决办法]
java 执行什么意思 ,
直接打开
Runtime.getRuntime().exec("cmd.exe /c start http://www.amcharts.com/fiddle/?id=amcharts/tZyTN");

[解决办法]
同求 帮你顶顶

读书人网 >Java相关

热点推荐