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?
“command to hit url in linux” Code Answercurl http://www.example.com/: good for normal use and debugging. Has lots of options. Especially usefull: --verbose to see the HTTP request/response and --head to send a HEAD request (no body). openssl s_client -connect www.example.com:443: Useful for debugging HTTPS servers.
xdg-open opens a file or URL in the user's preferred application. If a URL is provided the URL will be opened in the user's preferred web browser. gnome-open works as well as xdg-open but neither knows what to do with naked domain. So gnome-open http://askubuntu.com works but not gnome-open askubuntu.com .
Under System Settings > Applications > Default Applications > Web Browser, change the "Open http and https URLs" setting to "in the following application" and choose your preferred browser from the dropdown list, then apply the change.
The most cross-distribution one is xdg-open http://stackoverflow.com
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