如果您可以将其缩小到Java 6,则可以使用桌面API:
http://java.sun.com/developer/technicalArticles/J2SE/Desktop/javase6/desktop_api/
应该看起来像:
if (Desktop.isDesktopSupported()) { Desktop desktop = Desktop.getDesktop(); if (desktop.isSupported(Desktop.Action.BROWSE)) { try { desktop.browse(new URI("http://localhost")); } catch(IOException ioe) { ioe.printStackTrace(); } catch(URISyntaxException use) { use.printStackTrace(); } } }
java.io.IOException:无法在sun.awt.X11.XDesktopPeer.browse(XDesktopPeer.java:64)的sun.awt.X11.XDesktopPeer.launch(XDesktopPeer.java:75)上显示URI: )在java.awt.Desktop.browse(Desktop.java:368) code> pre>