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?
相关问题
- Is shmid returned by shmget() unique across proces
- how to get running process information in java?
- TestCafe - The browser always starts in clean slat
- UrlEncodeUnicode and browser navigation errors
- Error building gcc 4.8.3 from source: libstdc++.so
I think a combination of xdg-open as described by shellholic and - if it fails - the solution to finding a browser using the
which
command as described here is probably the best solution.In Java (version 6+), you can also do:
Though this won't work on all Linuxes. At the time of writing, Gnome is supported, KDE isn't.
At least on Debian and all its derivatives, there is a 'sensible-browser' shell script which choose the browser best suited for the given url.
http://man.he.net/man1/sensible-browser