Assuming you want to run the windows notepad.exe program, you are looking for the exec function. You probably want to call something like:
Runtime runtime = Runtime.getRuntime(); Process process = runtime.exec("C:\\path\\to\\notepad.exe C:\\path\\to\\file.txt");
For example, on my machine, notepad is located in C:\Windows\notepad.exe :
Runtime runtime = Runtime.getRuntime(); Process process = runtime.exec("C:\\Windows\\notepad.exe C:\\test.txt");
This will open a notepad with the test.txt file open for editing.
Please note that you can also specify the third parameter exec , which is the working directory to run, so you can run the text file, which is stored relative to the working directory of your program.
Stephen
source share