更新时间:2023-12-05 10:01:34
参见 Desktop.browse(URI)
。
我收到错误,
无法对非静态方法进行静态引用浏览(URI)类型桌面
不,这是当您尝试在类上调用实例方法时会发生的情况。你需要一个桌面
对象。
No, that is what will happen when you attempt to call an instance method on a class. You need a Desktop
object.
URI uri = new URI("http://google.com/");
Desktop dt = Desktop.getDesktop();
dt.browse(uri.toURL());