Java newbie question..
In windows, if I want to start another application from Java-code,
(like notepad.exe or invoke a document c:\mydoc.htm with my
default-browser)
what class/method do I use in Java?
TIA,
------------------------------------------ grz01
Andrew Thompson - 07 Nov 2005 12:44 GMT
> Java newbie question..
Note that a good group for those new to Java is ..
<http://www.physci.org/codes/javafaq.jsp#cljh>
> In windows, if I want to start another application from Java-code,
> (like notepad.exe or invoke a document c:\mydoc.htm with my
> default-browser)
> what class/method do I use in Java?
<http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Runtime.html#exec(java.lang.String)>
[ ..and it's overloaded variants - scroll down. ]
HTH
chris_k - 07 Nov 2005 12:45 GMT
hi,
you may use
Process proc = Runtime.getRuntime().exec("notepad.exe");
HTH,
chris
Roedy Green - 07 Nov 2005 13:43 GMT
>In windows, if I want to start another application from Java-code,
>(like notepad.exe or invoke a document c:\mydoc.htm with my
>default-browser)
>what class/method do I use in Java?
see http://mindprod.com/jgloss/exec.html

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
Rhino - 07 Nov 2005 14:34 GMT
> Java newbie question..
>
[quoted text clipped - 5 lines]
> TIA,
> ------------------------------------------ grz01
There is an excellent article on the techniques to use - and some pitfalls
to avoid - in this article:
http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps_p.html
The author begins by showing you basic approaches that may or may not work
very well, then gradually improves them until he has arrived at fairly
bulletproof ways of executing commands or external programs via Java.
Rhino