• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

opening another program

 
Dan Maples
Ranch Hand
Posts: 153
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey guys, does anybody know if its possible for java to open another program like internet explorer? What I'm trying to do is use jave to write and save a html file and then use internet explorer to open it. I have already written the code to write and save the html file and it works, but I'm not sure if it is even possible to have java open up a internet explorer window. If anybody knows if it is possible or definantly impossible please let me know, also if it is possible is there a way to have it come up with my html file already displayed in the window?
Thanks in advance- Dan
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's a family of exec() methods in the java.lang.Runtime() class that can launch new processes.
 
Dan Maples
Ranch Hand
Posts: 153
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ernest, so if I understand this correctly to open up internet explorer I would use:


and that would open up internet explorer? If I copy/pasted this exactly into my program would it work? And do I need to import anything? Also one last tiny little thing, how can I get it to open up a specific file?
Thanks for all the help!!!
-Dan
 
Darin Niard
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, that wouldn't work... I think you need to learn how to read the API. When you see public Process exec(String s), that is the method signature for exec. So when you call .exec() it accepts a String, and returns a Process. You aren't supposed to rewrite it.
 
Dan Maples
Ranch Hand
Posts: 153
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry I'm new to this, so Darin, so if I understand you correctly I just need to use:


what should A be?
Thanks for correcting me
[ July 09, 2004: Message edited by: Dan Maples ]
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Instead of tying your program to a specific installation of internet explorer, you may prefer to make use of BrowserLauncher or the WebBrowser example in chapter 2 of Deitel's "Advanced Java 2 Platform How to Program". The source code for that book can be downloaded at http://www.deitel.com/books/downloads.html#advjHTP1
 
Dan Maples
Ranch Hand
Posts: 153
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey Dirk!!! that was exactly what I needed!!! that was perfect!!! thank you sooooo much that was sooo helpful!!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic