我更新到1.7.0_67-b01
,现在我似乎无法在我的swing应用程序中嵌入JavaFX面板。
这是我得到的例外。
有人知道解决方法吗?
java.security.AccessControlException: access denied ("java.util.PropertyPermission" "javafx.macosx.embedded" "write")
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.lang.System.setProperty(Unknown Source)
at javafx.embed.swing.JFXPanel$1.run(Unknown Source)
at javafx.embed.swing.JFXPanel$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at javafx.embed.swing.JFXPanel.initFx(Unknown Source)
at javafx.embed.swing.JFXPanel.<init>(Unknown Source)
at webview.WebBrowserFX.<init>(WebBrowserFX.java:38)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at baf.ui.WebView.initializeFXWebView(Unknown Source)
at baf.ui.WebView.<init>(Unknown Source)
at mypackage.MyClass.<init>(Unknown Source)
答案 0 :(得分:1)
您应该修改策略文件($JAVA_HOME/jre/lib/security/javaws.policy
)以包含写入此属性的权限。因此,您应该将此行添加到javaws.policy
:
permission java.util.PropertyPermission "javafx.macosx.embedded", "write";
似乎是old bug
答案 1 :(得分:0)
我尝试了post中建议的内容并且有效。
我以编程方式添加权限。
PropertyPermission propertyPermission = new PropertyPermission("javafx.macosx.embedded", "write");
然而,原始政策的权限将丢失。