Linux: command to open URL in default browser

后端 未结 10 1847
青春惊慌失措
青春惊慌失措 2020-12-07 17:47

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?

10条回答
  •  隐瞒了意图╮
    2020-12-07 18:04

    In Java (version 6+), you can also do:

    Desktop d = Desktop.getDesktop();
    d.browse(uri);
    

    Though this won't work on all Linuxes. At the time of writing, Gnome is supported, KDE isn't.

提交回复
热议问题