怎么调用dos命令? Runtime.getRuntime().exec("dos command"); 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 import java.io.*;public class CmdExec { public CmdExec(String cmdline) { try { String line; Process p = Runtime.getRuntime().exec(cmdline); BufferedReader input = new BufferedReader (new InputStreamReader(p.getInputStream())); while ((line = input.readLine()) != null) { System.out.println(line); } input.close(); } catch (Exception err) { err.printStackTrace(); } }public static void main(String argv[]) { new CmdExec("myprog.bat"); }}[myprog.bat]echo hello world! Java applet 安全性问题 hashmap键值 java小游戏保龄球中怎么去掉画出来的物体 java是否有操作串并口的API ? 高分求教设置JTable中单元格颜色的问题?急急急!!!解决马上给分! Java五子棋 如何把JFrame右上角的X按钮去掉不显示? JAVA APPLET 出错提示. 散分!!!有没有JAVA和C++双重高手??? 为什么我的问题总是没有人回答呢? 如何對applet圖形存檔?? 我看到有JDK1.4了 呵呵~~~~
public class CmdExec {
public CmdExec(String cmdline) {
try {
String line;
Process p = Runtime.getRuntime().exec(cmdline);
BufferedReader input =
new BufferedReader
(new InputStreamReader(p.getInputStream()));
while ((line = input.readLine()) != null) {
System.out.println(line);
}
input.close();
}
catch (Exception err) {
err.printStackTrace();
}
}public static void main(String argv[]) {
new CmdExec("myprog.bat");
}
}[myprog.bat]
echo hello world!