Toza
Toza

Reputation: 1358

Opening a non-default browser in Java

So I understand that using the method:

Desktop.getDesktop().browse(URI.create("http://www.stackoverflow.com/"));

I can open a webpage with my default browser, but is there a way I can specify a path to a non-default browser and open a url with that one? ie. my default is Chrome, but I want to open in Mozilla Firefox.

Upvotes: 2

Views: 2061

Answers (1)

David
David

Reputation: 3418

You need to use Runtime.exec(). Mkyong has a good example for you.

Upvotes: 2

Related Questions