Samstag, 4. Juli 2009

Start notepad with java

Open notepad with java


private void execute() {
Runtime r=Runtime.getRuntime();
try {
Process p=r.exec("notepad.exe");
} catch (IOException e) {
e.printStackTrace();
}
}




Open a file in notepad with java


private void execute() {
Runtime r=Runtime.getRuntime();
try {
Process p=r.exec("notepad.exe C://yourfile.txt");
} catch (IOException e) {
e.printStackTrace();
}
}

Keine Kommentare: