Package ioTest. io1;/** Runtime: each Java application has a Runtime class instance, so that the application can be connected to the running environment. * This is also an important reason for jvm to implement cross-platform. * You can use the getRuntime method to obtain the current runtime. * API analysis: * public class Runtime extends Object * each Java application has a Runtime class instance so that the application can be connected to the running environment. * You can use the getRuntime method to obtain the current runtime. * Applications cannot create their own Runtime class instances. ** the APIS found that there are no constructors, but there are non-static methods, then there must be a static method to get the Runtime Instance Object * getRuntime () and return the Runtime objects related to the current Java application. * **/Public class RuntimeDemo {public static void main (String [] args) throws Exception {Runtime runtime = Runtime. getRuntime (); // execute the command to start the console to enter the command and execute it. // You can use a Java program to start any file in a Java program. Process process=runtime.exe c ("D: \ app \ Xmp \ Program \ XMP.exe");/** exec () returns the Process Class Object * Process class: except constructors, the rest are abstract methods, which should have been implemented for subclasses. * However, the Process class is not subclass. In fact, when calling the above method, the system resource * is called to create an instance of this class. * // Thread. sleep (4000); process. destroy (); // you cannot end a process that is not started by the preceding method, because you cannot obtain the corresponding object. // Easy to use. runtime.exe c ("notepad.exe C: \ Users \ Leon \ New folder \ ioTest \ src \ ioTest \ io1 \ RuntimeDemo. java "); // question: how to solve the above problem with relative paths ?}}