I develop applet in Eclipse and it runs okay using default in-built Applet Viewer. It does not work in browser because of many security exceptions. So with every code change I have to rebuild the jar and run it in browser (IE) to test.
How can I enforce Eclipse Applet Viewer to use same security policies as IE browser for applets?
I have tried to specify JVM argument as follows, but still applet is successful in Eclipse, but I need it to fail because of security policy.
-Djava.security.policy=="java.policy.applet"
Eclipse automatically creates a policy file “java.policy.applet” in the root of your compiled project which grants all permissions. And its set the JVM parameter “-Djava.security.policy=java.policy.applet”. It seems that this behavior cannot be disabled.
You can try to add the same JVM parameter with a different policy file, however Eclipse adds its parameter after yours, and the JVM seem to consider just the last one. So this does not help.
But, if you create your own policy file (java.policy.applet) in the root of your source folder, Eclipse does not overwrite it. You can copy %JAVA_HOME%\lib\security\java.policy to get the real java policies.