How to get Desktop class supported under Linux?

后端 未结 2 1707
醉酒成梦
醉酒成梦 2020-12-16 20:38

I am writing a java application and I want to open a link from my program in user\'s default internet browser. I tried to use class Desktop like this :

if (D         


        
2条回答
  •  时光取名叫无心
    2020-12-16 21:14

    From this article

    Use the Desktop.isDesktopSupported() method to determine whether the Desktop API is available. On the Solaris Operating System and the Linux platform, this API is dependent on Gnome libraries. If those libraries are unavailable, this method will return false. After determining that the API is supported, that is, the isDesktopSupported() returns true, the application can retrieve a Desktop instance using the static method getDesktop().

    Try running your code on Gnome desktop.

提交回复
热议问题