What command we have to execute (from Java, but that should not matter) on Linux (different common distributions) to open a given URL in the default browser?
For opening a URL in the browser through the terminal, CentOS 7 users can use gio open command. For example, if you want to open google.com then gio open https://www.google.com
will open google.com URL in the browser.
xdg-open https://www.google.com
will also work but this tool has been deprecated, Use gio open
instead. I prefer this as this is the easiest way to open a URL using a command from the terminal.
I believe the simplest method would be to use Python:
python -m webbrowser "http://www.example.com/"
The most cross-distribution one is xdg-open http://stackoverflow.com
on ubuntu you can try gnome-open.
$ gnome-open http://www.google.com