• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to execute a browser

 
Shane Roylance
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not trying to kill the browser, but I am trying to execute a browser from my java application. The only way I have found so far to do this is to use And while this will work, I was hoping for something a little more generic that would execute the default browser (not a hard coded one), and display the given URL.
So is there another way???
 
Jason Kretzer
Ranch Hand
Posts: 280
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe you can do it like this.
using this website
http://www.reallifecomics.com/d/20000518.html
use this:

Note: I have only proven this to be correct, I have not actually tested it.
 
Rob Ross
Bartender
Posts: 2205
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually the simplest way is :
Runtime.getRuntime().exec("start http://www.reallifecomics.com");
This will use the default browser.
[ May 28, 2002: Message edited by: Rob Ross ]
 
Shane Roylance
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the suggestions Jason and Rob, unfortunately they are not working for me. I get an IOException from the exec command that says "CreateProcess: <command entered> error=2". I haven't been able to find out exactly what this means, but I assume it means I can't figure out what you are trying to exec. It happens with just the HTTP string or with the start preceding it.
That brings me to another question would a Runtime.exec() command be more comparable to the dos command prompt or the Start->Run dialog?
 
Shane Roylance
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does anyone have any ideas as to why the previous suggestions were not working for me? I am developing and running on Win2K.
 
David Weitzman
Ranch Hand
Posts: 1365
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JConfig claims to be able to launch web browsers.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic