在Java中6u13 +启动从Java Webstart的(JNLP)浏览器窗口
-
12-09-2019 - |
题
有在Java中6u13和6u14的一个错误。 http://bugs.sun.com/view_bug.do?bug_id=6835450
简单地说,下面的代码是应该打开一个浏览器窗口,但由于在框架中的一个错误,它停在Java 1.6的更新工作13.没事打开了。有类似的bug的Java小应用程序(即固定在更新14),但是这一次仍然对Java Webstart的/ JNLP更新14存在。
getAppletContext().showDocument(new URL("http://www.sun.com"),"_blank");
你知道任何变通办法?
解决方案
我还没有尝试在JNLP,但通常这应该工作:
java.awt.Desktop.getDesktop().browse(new URI("http://www.sun.com"));
其他提示
请问BasicService.showDocument
工作?我不记得如何被实现了手。
或者,使用LiveConnect的执行JavaScript自己(尽管这可能会遇到同样的问题)。
public boolean openUrl(final URL url) {
try {
// Lookup the javax.jnlp.BasicService object
BasicService bs = (BasicService)javax.jnlp.ServiceManager.lookup("javax.jnlp.BasicService");
// Invoke the showDocument method
return bs.showDocument(url);
} catch(UnavailableServiceException ue) {
// Service is not supported
log.log(Level.WARNING, "Could not open URL " + url, ue);
return false;
}
}
不隶属于 StackOverflow