Sunday, November 19, 2017

LAB 9 - TO OPEN ANY PROCESS

PROCESS EXAMPLE 3: TO OPEN ANY EXISTING NOTEPAD APPLICAITON
import java.io.IOException;
public class notepad {
public static void main(String[] args) {
          Runtime rt = Runtime.getRuntime();
try {
   rt.exec("C:\\Windows\\System32\\notepad.exe E:\\Samplenotepad.txt");
}
 catch (IOException ex) {
System.out.println(ex);                                                                  
}  }  }
 
OUTPUT: This will open any existing file using any application for. eg. notepad

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.