java的Runtime使用实例

来源:互联网 发布:mac finder无响应 编辑:程序博客网 时间:2024/05/22 21:29
public class TestRuntime{   public static void main(String[] args)throws Exception      {      Runtime rt = Runtime.getRuntime();      System.out.println("处理器数量:"+ rt.availableProcessors());      System.out.println("空闲内存数"+ rt.freeMemory());      System.out.println("总内存数:"+rt.totalMemory());      System.out.println("可用最大内存数:"+rt.maxMemory());      //启动一个线程来运行notepad笔记本程序      System.out.println(rt.exec("notepad.exe"));      }}