Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Call other windows program from Java program

 
Marco Yeung
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 783
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic