Permission + Policy File + Java Applet
844235Sep 10 2011 — edited Sep 12 2011Hi everyone,
I developped a small Java applet for testing purposes.
The aim of the applet is getting data from a MySql database and displayed it into a JLabel.
I use a MySql jdbc layer contained in a Jar file.
I tested the applet locally via Eclipse and it works fine.
Then, I packaged my ".class" files into a Jar file.
I uploaded the resulting Jar file to the server as well as the jdbc Jar file.
I tried to launch the applet located on the server from my web browser (IE9).
An error occured.
I analysed the results in the Java console.
The reason of the problem follows :
I miss a permission grant in my policy file.
The missing line is : permission java.util.PropertyPermission "file.encoding", "read";
For information, the policy file is located at : jre7|lib|security
I do no want to ask the users of my future applet to modify their policy file.
So, I am wondering if there is a way to consider a custom policy file when executing a Java applet.
The custom policy file would be located on the same server as the applet is.
Thanks in advance for your help.