Desktop.getDesktop().browse Hangs

前端 未结 3 490
一个人的身影
一个人的身影 2021-01-21 11:07

I\'m working on an application in which if a user clicks on a link, I want it to open in their default browser. From what I\'ve read, this should in theory work, however, when r

3条回答
  •  清酒与你
    2021-01-21 11:51

    What do you get from this?:

    if (Desktop.isDesktopSupported()) {
      System.out.println("Desktop IS supported on this platform ");
    
      if (Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) {
        System.out.println("Action BROWSE  IS supported on this platform ");
      }
      else {
        System.out.println("Action BROWSE  ISN'T supported on this platform ");
      }
    }
    else {
      System.out.println("Desktop ISN'T supported on this platform ");
    }
    

    Also, have a look at this and this answers here at stackoverflow.

提交回复
热议问题