请问JAVA怎样调用dos命令呢? ToolKit.getRuntime().exec("需要执行的DOS命令"); 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 ToolKit.getRuntime().exec("需要执行的DOS命令"); InputStream isPing = null; InputStreamReader isrPing = null; StringBuffer sb = new StringBuffer(); Process psPing = null; Process psTracert = null; try { psPing = rt.exec("tracert " + ip); isPing = psPing.getInputStream(); isrPing = new InputStreamReader(isPing); int t; while ( (t = isPing.read()) != -1) { if (t == 10) sb.append("<br>"); sb.append( (char) t); } isPing.close(); isrPing.close(); //logger.debug(sb.toString()); } catch (IOException ex) { logger.error("IOException :" + ex.toString()); errors.add("supervise", new ActionError("error.supervise.pingfail")); saveErrors(httpServletRequest, errors); return actionMapping.findForward("fail"); } 有没有在说得详细一点的呢? 比如说我要调用远程计算机的DOS命令来对远程计算机进行操作呢? 谢谢! swing html java编程实现tiff图片转换成jpg格式 会javamail高手~~~~~~求救啊 GUI程序显示操作进度 java字符串替换问题 子类的构造函数不调用基类的构造函数,可以吗 求推荐一些java学习方法 会ant的请进!!!!!!!!1 集思广益:java_sqlServer ,b/s、c/s有经验的朋友进 static METHOD in ActionLinstener 怎么才能让Eclipse支持中文? 怎么实现console里的输出固定在一行,即不要滚屏?
InputStreamReader isrPing = null;
StringBuffer sb = new StringBuffer();
Process psPing = null;
Process psTracert = null; try {
psPing = rt.exec("tracert " + ip);
isPing = psPing.getInputStream();
isrPing = new InputStreamReader(isPing);
int t;
while ( (t = isPing.read()) != -1) {
if (t == 10)
sb.append("<br>");
sb.append( (char) t);
}
isPing.close();
isrPing.close();
//logger.debug(sb.toString());
}
catch (IOException ex) {
logger.error("IOException :" + ex.toString());
errors.add("supervise", new ActionError("error.supervise.pingfail"));
saveErrors(httpServletRequest, errors);
return actionMapping.findForward("fail");
}
比如说我要调用远程计算机的DOS命令来对远程计算机进行操作呢?
谢谢!