How to open notepad using java program
Notepad is a text editor from windows operating system. We use notepad for writing text files.
We can open a new notepad using java code.
By using the concept of running another application by Runtime class in java.
By creating object of runtime and calling exec() method by passing application name.
Lets see how to open a notepad using java code
OutPut::
Program #1: Java example program to open notepad
- package interestingJavaprograms;
- import java.io.IOException;
-
- public class NotepadJava {
-
- /**
- * @ www.corejavawithselenium.blogspot.in
- * @ how to open a new notepad using java program
- */
- public static void main(String[] args) {
-
- Runtime rt = Runtime.getRuntime();
-
- try {
- rt.exec("notepad");
- }
- catch (IOException ex) {
-
- System.out.println(ex);
-
- }
-
- }
-
- }
OUPUT::
No comments:
Post a Comment