I see. I was used to knowing that classes always have their constructor/s. I guess this is one exception.
Thanks alot. On Aug 8, 1:11 am, pacior <[email protected]> wrote: > According to javadoc, there is no constructor for this class, and each > application has always its own Runtime class. > > Regards, > Pacior > > On Aug 7, 7:22 pm, chEveLLe <[email protected]> wrote: > > > 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 -~----------~----~----~----~------~----~------~--~---
