This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes How do I open a Windows program from a Java program? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "How do I open a Windows program from a Java program?" Watch "How do I open a Windows program from a Java program?" New topic
Author

How do I open a Windows program from a Java program?

Matthew Alesi
Ranch Hand

Joined: Sep 13, 2006
Posts: 38
Just a simple task I'm trying to do in a program I made: it produces an HTML file which I subsequently want Internet Explorer to open up and print out. I have everything working up to the point where I need to open IE...and then I realized I don't know how. How can I do this?'

Thanks!


-Matt
Current CS undergrad
SCJP 5.0
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Opening IE for a specific page or file is easy enough. Just use Runtime.exec() to run "iexplore file://whatever.html". Getting IE to print thereafter though, that is hard. Is there any reason why you want IE to print the file? You could just use the Java Print Service API to do it without the involvement of IE.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Prabhu Venkatachalam
Ranch Hand

Joined: Nov 16, 2005
Posts: 502

If you want to do OS specific things, you can use RunTime.exec(..);

To execute find the code snippet,



Prabhu Venkatachalam<br />SCJP 1.4,SCWCD 1.4<br />prabhu.venkatachalam@gmail.com
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How do I open a Windows program from a Java program?
 
Similar Threads
opening another program
activating menu items
help get menu items to work pleas
Creating an Object with JavaScript
activating menu items