This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Call other windows program from Java program Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Call other windows program from Java program" Watch "Call other windows program from Java program" New topic
Author

Call other windows program from Java program

Marco Yeung
Greenhorn

Joined: Sep 21, 2001
Posts: 5
Dear all,
How can I use pure Java program to call Windows programs(.exe)? e.g notepad.exe. Is there any package available in JDK?
thanks
Marco
Peter Tran
Bartender

Joined: Jan 02, 2001
Posts: 783
Marco,
You can use one of the various java.lang.Runtime.exec() methods. *WARNING* Using this method will probably make your code platform depedent. Using exec() is not JAVA friendly.
For example, there is no way for me to run your application on a UNIX box if it's going to try to kick off a notepad.exe application.
-Peter
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Call other windows program from Java program