List of usage examples for java.awt Desktop isSupported
public boolean isSupported(Action action)
From source file:base.BasePlayer.Main.java
public static void gotoURL(String url) { if (!java.awt.Desktop.isDesktopSupported()) { System.err.println("Desktop is not supported"); System.exit(1);/*from w w w .j a va2 s . c o m*/ } java.awt.Desktop desktop = java.awt.Desktop.getDesktop(); if (!desktop.isSupported(java.awt.Desktop.Action.BROWSE)) { System.err.println("Desktop doesn't support the browse action"); System.exit(1); } try { java.net.URI uri = new java.net.URI(url); desktop.browse(uri); } catch (Exception ex) { Main.showError("Can not open URL.", "Error"); //System.err.println( ex.getMessage() ); ex.printStackTrace(); } }