0

I updated to 1.7.0_67-b01 and now it seems I can't embed a JavaFX panel in my swing application. This is the exception I get. Anyone knows a workaround?

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)
Spiff
  • 3,873
  • 4
  • 25
  • 50

2 Answers2

1

You should modify your policy file ($JAVA_HOME/jre/lib/security/javaws.policy) to include permissions to write this property. So, you should add this line to javaws.policy:

permission java.util.PropertyPermission "javafx.macosx.embedded", "write";

It seems to be the old bug

Dmitry Ginzburg
  • 7,391
  • 2
  • 37
  • 48
  • But I don't need a policy file. The application is signed. Also how would I force all the users to modify their policy file? – Spiff Aug 05 '14 at 14:04
  • I checked the bug, Oracle says that this is not a issue! Although the bug is old this occurs only with update 67. With 65 it works. – Spiff Aug 05 '14 at 14:36
  • Then I have to ask on how do you deploy your application. I would recommend just using "javafxpackager -deploy". – Dmitry Ginzburg Aug 06 '14 at 10:16
  • It's a swing application. The user has just to hit the jnlp, and Javaws would take care the rest. By the way I tested Java 8 Update 20, and it works also, no issue. It's not a bug according oracle, so oracle never fixed and never will, and yet the error occurs in some java versions! – Spiff Aug 06 '14 at 13:18
  • That's okay, javafxpackager creates jnlp too – Dmitry Ginzburg Aug 06 '14 at 13:27
0

I tried what's suggested in this post and it works.

I add the permission programmatically.

PropertyPermission propertyPermission = new PropertyPermission("javafx.macosx.embedded", "write");

However the permissions of the orginal policy are lost.

Community
  • 1
  • 1
Spiff
  • 3,873
  • 4
  • 25
  • 50