在 Java 6u13+ 中从 Java WebStart (JNLP) 启动浏览器窗口 [英] Launching a browser window from Java WebStart (JNLP) in Java 6u13+
问题描述
Java 6u13 和 6u14 中存在一个错误.http://bugs.sun.com/view_bug.do?bug_id=6835450
There is a bug in Java 6u13 and 6u14. http://bugs.sun.com/view_bug.do?bug_id=6835450
简单地说,下面的代码应该打开一个浏览器窗口,但由于框架中的一个错误,它在 Java 1.6 update 13 中停止工作.没有任何打开.Java 小程序也有一个类似的错误(在更新 14 中修复),但这个错误仍然存在于 Java WebStart/JNLP 的更新 14 中.
Simply put, the following code is supposed to open a browser window, but because of a bug in the framework, it stopped working in Java 1.6 update 13. Nothing opens anymore. There was a similar bug for Java applets (that was fixed in update 14), but this one still exists in update 14 for Java WebStart/JNLP.
getAppletContext().showDocument(new URL("http://www.sun.com"),"_blank");
您知道任何解决方法吗?
Do you know of any workarounds?
推荐答案
我没有在 JNLP 中尝试过,但通常应该可以:
I've not tried it in JNLP, but normally this should work:
java.awt.Desktop.getDesktop().browse(new URI("http://www.sun.com"));
这篇关于在 Java 6u13+ 中从 Java WebStart (JNLP) 启动浏览器窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!