Java Reflection problem in applet under Sun plugin and Netscape.
I want to be able to call a showDocument using reflection, i.e.:
--
Object o = getAppletContext();
Method myMethod = o.getClass().getMethod("showDocument",
new Class[]{URL.class});
myMethod.invoke(o, new Object[]{new URL(myUrl)});
---
Under Internet Explorer w/ MS JVM, this works fine, however,
under Netscape, I'll get the following error:
java.lang.IllegalAccessException: netscape/applet/MozillaAppletContext
With the plugin, I'll get:
java.security.AccessControlException: access denied
(java.lang.RuntimePermission
accessClassInPackage.sun.plugin.viewer.context)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:270)
at java.security.AccessController.checkPermission(AccessController.java:401)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:542)
at java.lang.SecurityManager.checkPackageAccess(SecurityManager.java:1513)
at sun.applet.AppletSecurity.checkPackageAccess(AppletSecurity.java:166)
at java.lang.Class.checkMemberAccess(Class.java:1408)
at java.lang.Class.getMethod(Class.java:950)
How can I make this work under the Sun plugin and Netscape (MS already
works fine), without having users change any setting etc (so run out
of the box). |