Problem : How to start notepad from a java program?
Step 1 - CODING Create a text file c:\sunilos\MySystem.java and copy below contents /* */public class MySystem { /** * Launch and native application notepad.exe * @param args * @throws Exception */ public static void main(String[] args)throws Exception{ Runtime.getRuntime().exec("notepad.exe"); }}Step 2 - DEPLOYMENT- Create a folder 'c:\sunilos'.
- Create or copy MySystem.java into 'c:\sunilos' folder.
- Open your command prompt and go to 'c:\sunilos'
- Compile MySystem.java with help of javac MySystem.java command. Compiled class file will be created in .\sunilos\MySystem.class folder
- Congratulations!! your Java program is ready to serve.
Step 3 - Testing- Make sure you are on Command Prompt under c:\sunilos directory
- Now start your java program from command prompt with help of
OutputIt will open Notepad<<Previous | Next>> |