Hi Java Programmer,
I'm wondering isn't there any constructor for the Runtime class? I've
noticed the new keyword isn't used at all, just the getRuntime()
static method.
Thanks!
--------------------------------------------------------------------------------------------------------
class RunOSProgram {
public static void main(String args[]) {
Runtime rt = Runtime.getRuntime();
Process proc;
try {
if (System.getProperty("os.name").startsWith("Windows")){
// Run a OS specific program
proc = rt.exec("notepad");
}
else{
proc = rt.exec("gedit");
}
proc.waitFor(); //try removing this line
} catch (Exception e) {
System.out.println("notepad is an unknown command.");
}
}
}
--------------------------------------------------------------------------------------------------------
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---