打开链接到默认浏览器
//package com.nowjava; /*来自 nowjava.com - 时 代 Java*/ import java.awt.Desktop; import java.net.URL; public class Main { public static void main(String[] argv) throws Exception { String url = "nowjava.com"; openLink(url); } public static void openLink(String url) { Desktop desktop = Desktop.isDesktopSupported() ? Desktop/** from 时 代 J a v a 公 众 号 - nowjava.com**/ .getDesktop() : null; if (desktop != null && desktop.isSupported(Desktop.Action.BROWSE)) { try { desktop.browse(