I want to know how to get the location of the user's default Internet browser in Java. How can I get this? I would prefer it as a URI to the browser's executable file. Must work cross-platform.
The safest thing you can do is something like this:
if (Desktop.isDesktopSupported())
{
Desktop.getDesktop().browse("your url here");
}
more info on the Desktop class (mail, print, edit, etc) here
You should be using the Desktop class for this. This is the cross platform API that will invoke the default browser.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With