start external program from Java

G

grz01

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
 
C

chris_k

hi,
you may use

Process proc = Runtime.getRuntime().exec("notepad.exe");

HTH,
chris
 
R

Rhino

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
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top