Java中的Runtime类详解
Java中的Runtime类详解
1.类注释
/**Every Java application has a single instance of class Runtime that allows the application to interface withthe environment in which the application is running. The current runtime can be obtained from the getRuntime method.每个java应用有单个类Runtime实例【让我想起了单例】,这允许应用去和应用正在运行的环境交互。目前的runtime对象能够从getRuntime()方法中获得。An application cannot create its own instance of this class.
应用程序本身不能创建这个类(Runtime)的实例@author unascribed@see java.lang.Runtime#getRuntime()@since JDK1.0*/
2.类代码
private static Runtime currentRuntime = new Runtime();
/**Returns the runtime object associated with the current Java application.Most of the methods of class Runtime are instance methods and must be invoked with respect to the current runtime object.返回与当前Java应用关联的runtime对象。大多数Runtime类的方法是实例方法,所以必须被调用与具体的当前运行时对象。@return the Runtime object associated with the current Java application.*/public static Runtime getRuntime() {return currentRuntime;}
/**Returns the number of processors available to the Java virtual machine.返回Java虚拟机可用的处理器数。This value may change during a particular invocation of the virtual machine. Applications that are sensitive to the number of available processors should therefore occasionally poll this property and adjusttheir resource usage appropriately. @return the maximum number of processors available to the virtual machine; never smaller than one@since 1.4*/public native int availableProcessors();
}
/**Executes the specified string command in a separate process.在一个单独的进程中执行指定的命令。This is a convenience method. An invocation of the form exec(command)behaves in exactly the same way as the invocation #exec(String, String[], File) exec(command, null, null).这是一个方便的方法。以exec(command)形式调用与exec(String,Stringp[],file)的表现是相同的。@param command a specified system command.【参数:一个指定的系统命令】@return A new Process object for managing the subprocess【返回值:一个新的用于管理子进程的的Process对象】@throws SecurityExceptionIf a security manager exists and its{@link SecurityManager#checkExec checkExec}method doesn't allow creation of the subprocess@throws IOExceptionIf an I/O error occurs@throws NullPointerExceptionIf <code>command</code> is <code>null</code>@throws IllegalArgumentExceptionIf <code>command</code> is empty@see #exec(String[], String[], File)@see ProcessBuilder*/public Process exec(String command) throws IOException {return exec(command, null, null);}
Java中的Runtime类详解相关推荐
- stringtokenizer java_基于Java中的StringTokenizer类详解(推荐)
StringTokenizer是字符串分隔解析类型,属于:Java.util包. 1.StringTokenizer的构造函数 StringTokenizer(String str):构造一个用来解析 ...
- Java中的Properties类详解Properties配置文件
1.Properties类是什么? Properties(Java.util.Properties),该类主要用于读取Java的配置文件,不同的编程语言有自己所支持的配置文件,配置文件中很多变量是经常 ...
- 【Java菜鸟 04】Java中的File类详解
Java.io.File类主要是完成了文件夹管理的命名.查询文件属性和处理目录等操作,它不进行文件夹内容的读取操作. 1.构造函数: File file = new File(inputPath); ...
- java configuration类_JAVA中的Configuration类详解
本文主要研究的是java中的configuration类的用法,涉及maven自动加载,pom.xml配置和简单的java代码,具体如下. properties文件是java平台默认的配置文件格式,其 ...
- Java中的static关键字详解
** Java中的static关键字详解 ** 在一个类中定义一个方法为static,即静态的,那就是说无需本类的对象就可以调用此方法.调用一个静态方法就是 "类名.方法名" ,静 ...
- java中的进制输出转换_Java I/O : Java中的进制详解
作者:李强强 上一篇,泥瓦匠基础地讲了下Java I/O : Bit Operation 位运算.这一讲,泥瓦匠带你走进Java中的进制详解. 一.引子 在Java世界里,99%的工作都是处理这高层. ...
- Java中的main()方法详解
源文作者:leizhimin 源文链接:http://lavasoft.blog.51cto.com/62575/53263 源文作者版权申明: 版权声明:原创作品,允许转载,转载时请务必以超链 ...
- java中properties作用,Java中Properties的使用详解
Java中有个比较重要的类Properties(Java.util.Properties),主要用于读取Java的配置文件,各种语言都有自己所支 持的配置文件,配置文件中很多变量是经常改变的,这样做也 ...
- java线程池ThreadPoolExecutor类详解
线程池有哪些状态 1. RUNNING: 接收新的任务,且执行等待队列中的任务 Accept new tasks and process queued tasks 2. SHUTDOWN: 不接收 ...
最新文章
- RecyclerView解析--onViewDetachedFromWindow()/onViewAttachedToWindow()
- Python字符串的两种方式——百分号方式,format的方式
- Storm On YARN
- MYSQL专题-使用Binlog日志恢复MySQL数据
- mysql临时表好处和坏处_mysql临时表产生的执行效率问题改进(转)
- MySQL的简单使用
- 动态规划求一个序列的最长回文子序列(Longest Palindromic Substring )
- mysql 生成日历表_如何在SQL中创建100年的日历表
- 操作系统---高响应比优先调度算法实例
- python打开图片操作步骤_python简单图片操作:打开\显示\保存图像方法介绍
- 服务器怎么与plc通讯协议,PLC如何与云服务器通讯
- 浅谈计算机网络安全问题和对策
- YML(YAML)语法(文件后缀为.yml格式)
- C++ 学生成绩管理系统
- PXC高可用集群(MySQL)
- BIOS密码的去除与破解
- sqlserver对数据进行加密、解密
- ValueError: DataFrame constructor not properly called!
- 393分上岸南昌大学信息工程学院软件工程专硕
- JavaScript 在元素前后添加元素
热门文章
- 构造函数、拷贝构造函数和析构函数的的调用时刻及调用顺序
- Caliburn.Micro学习笔记(三)----事件聚合IEventAggregator和 IhandleT
- 雷死人不偿命-----六年级小学生的字条
- python中with语句的使用
- C#中Equals和==的比较
- [ 测试管理 ] 如何描述缺陷报告?
- [Elasticsearch] 邻近匹配 (二) - 多值字段,邻近程度与相关度
- WPF 绑定以基础数据类型为集合的无字段名的数据源
- MindManager脑图之项目管理甘特图
- “staticMetaObject”: 不是“****”的成员