Free CoreJava Programs Source codes | Examples | Video Tutorials Download

Wednesday, January 21, 2009

Open Windows Notepad From Java

/**

* Open windows notepad.

*

*

*/

public class RuntimeTest {

/**

* open notepad using Runtime class

*

*/

public static void openNotepad() {

try {

// open the notepad

Runtime.getRuntime().exec("notepad");

} catch (Exception e) {

System.out.println("Error Occured!!");

e.printStackTrace();

}

}

/**

* execution begin from here

*

* @param args

* command line arguments

*/

public static void main(String[] args) {

openNotepad();

}

}

No comments:

Post a Comment

Followers