Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > start external program from Java

Reply
Thread Tools

start external program from Java

 
 
grz01@spray.se
Guest
Posts: n/a
 
      11-07-2005

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

 
Reply With Quote
 
 
 
 
Andrew Thompson
Guest
Posts: n/a
 
      11-07-2005
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:

> 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
 
Reply With Quote
 
 
 
 
chris_k
Guest
Posts: n/a
 
      11-07-2005
hi,
you may use

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

HTH,
chris

 
Reply With Quote
 
Roedy Green
Guest
Posts: n/a
 
      11-07-2005
On 7 Nov 2005 04:31:17 -0800, (E-Mail Removed) wrote, quoted or
indirectly quoted someone who said :

>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
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
 
Reply With Quote
 
Rhino
Guest
Posts: n/a
 
      11-07-2005

<(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
>
> 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/j...9-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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
start external program from python Bjorn Python 2 10-12-2009 07:47 PM
Running Java Program from a Java Program Shadow123 Java 1 07-09-2008 08:20 PM
How to launch One Java Program from another Java Program joshivaibhav Java 3 11-21-2006 05:42 PM
How to javac a java program w/ another java program which is w/o a main method cjeffwang@yahoo.com Java 1 10-31-2005 04:25 AM
Calling Java program in another Java program Rey Java 4 12-12-2003 10:18 PM



Advertisments