关于Runtime.getRuntime().exec的问题。高分(100) 你是怎么调用的?是不是Runtime.getRuntime().exec("cmd /c xxx.bat");如果是这样,我不知道怎么优化! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 我没有用cmd /c,而是直接用Runtime.getRuntime().exec("xxx.bat");我两种方法都试了,好象效果一样 你是执行什么操作啊!我执行备份挺快的啊!import java.util.*;public class Property { public static void main(String[] args) { System.out.println(new Date()); Properties p = System.getProperties(); // p.list(System.out); System.out.println("--- Memory Usage:"); Runtime rt = Runtime.getRuntime(); try { rt.exec("cmd /c c:\\bat\\copy.bat"); }catch(Exception e) { System.out.println(e.getMessage()); } System.out.println("Total Memory = " + rt.totalMemory() + " Free Memory = " + rt.freeMemory()); }} I want to know too cmd start Your.bathttp://www.rgagnon.com/javadetails/java-0014.html 关于JDBC中Connection的问题。。 计算器中出现的异常!? ==线程问题求救= 关于html:select的问题 大家好,DragSource 熟悉吗, 如何用Java实现多个图层的切换? 求助:成功配置JSP环境后遇到的问题!! 线程相关,JEditorPane相关 寻找中文版类库!!及说明!!多谢帮忙,定当高分报答!! 请问,在JAVA下如何编程让机器重启? jPopupMenu的问题 关于Runtime.getRuntime().exec()处理打印命令错误
我两种方法都试了,好象效果一样
import java.util.*;public class Property {
public static void main(String[] args) {
System.out.println(new Date());
Properties p = System.getProperties();
// p.list(System.out);
System.out.println("--- Memory Usage:");
Runtime rt = Runtime.getRuntime();
try
{
rt.exec("cmd /c c:\\bat\\copy.bat");
}catch(Exception e)
{
System.out.println(e.getMessage());
}
System.out.println("Total Memory = "
+ rt.totalMemory()
+ " Free Memory = "
+ rt.freeMemory());
}
}