Skip to main content

Launch Web Browser on Linux ?

1 reply [Last post]
nightrider
Offline
Joined: 2003-06-11
Points: 0

Hello,

I'd like to launch a Web Browser from my Java application.
On Windows, I'm using

<br />
 Runtime.exec("rundll32 url.dll,FileProtocolHandler "+url);<br />

How can I do a similar thing on Linux ?
The tricky part is to find the currently installed default browser.

Besides, I found that it's quite hard to launch two instances of Mozilla at the same time :-(
The first window can be launched with

<br />
 Runtime.exec("mozilla "+url);<br />

However, the second window needs to be launched with

<br />
 Runtime.exec("mozilla -remote openURL("+url+")");<br />

Is there an easier way to accomplish this ?

Thanks in advance,
Peter

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
acechase
Offline
Joined: 2003-12-02
Points: 0

You're in luck, there's a great little tool called BrowserLauncher that works well.

http://browserlauncher.sourceforge.net/