Java.lang
class Runtime
Public class Runtime extends Object
each Java application has a Runtime class instance that enables the application to Operating Environment Connect.
The operating environment is the system, the Java application needs to rely on the system, allocating memory, computing address, platform provides, etc., the virtual machine runs when parsing. Runtime instances are created when the Java application is running.
the runtime class, without constructors, cannot be instantiated, but also provides a non-static method. So it should be provided with a static return value type for the runtime method to get the object.
package cn.itcast.p1.other; import java.io.ioexception; public class RuntimeDemo { /** * @param args * @throws IOException * @throws InterruptedException */public static Void main (String[] args) throws IOException, InterruptedException { //gets the runtime object. runtime r = runtime.getruntime (); //calls exec to execute a program. Open a Java file with the Notepad program process p = r.exec ("Notepad.exe e:\\demo.java" ); //thread.sleep (4000); //p.destroy (); } }
Api--runtime