Desktop API is not supported on the current platform

后端 未结 4 754
轮回少年
轮回少年 2020-12-01 04:16

I have encountered this error:

java.lang.UnsupportedOperationException: Desktop API is not supported on the current platform

I w

4条回答
  •  旧巷少年郎
    2020-12-01 04:30

    I am using Ubuntu 12.04 LTS 64-bit with Oracle jdk1.6.0_45 and was having the same problem. I’m running gnome-classic as the desktop instead of Unity. This is what worked for me:

    sudo apt-get install libgnome2-0
    

    After installing this package I restarted my Java Swing app and Desktop.getDesktop().open(new File("myfile")); worked just fine.

提交回复
热议问题