How to open notepad using java code

Below is the java source code in order to open the notepad application. Once after running this program your notepad application will be opened.

import java.io.IOException;

class Notepad {
    public static void main(String[] args) {
        Runtime rs = Runtime.getRuntime();

        try {
            rs.exec("notepad");
        } catch (IOException e) {
            System.out.println(e);
        }
    }
}

2 comments:

  1. Great blog!!! Your blog has all the information on core java and other related stuff. Thanks for sharing and keep blogging!!!

    Cheers,
    http://www.flowerbrackets.com/how-to-open-notepad-in-java/

    ReplyDelete
  2. If you're looking for the best Things to do
    in the world, this list has something for everybody! From adventure to culture, food to history .

    ReplyDelete