I'm trying to save a buffered image to a png file. I've used ImageIO.write(image, "png", file). When I run it I get "java.security.AccessControlException: access denied (java.io.FilePermission map delete)" I'm trying to save to map.png which is in the same folder as my applet.
06-12-2006, 03:13 AM
graviton
applet's may not write to harddisk. this is a security policy. what would happen, if any applet from the internet would have write-access to your harddisc?
make it an aplication or change your applet security policy.
06-15-2006, 01:12 AM
Angel106
How do u change an applet's security policy?
06-16-2006, 07:42 AM
graviton
usually, you have to change the java.policy file located somewhere in the jre and jsdk folders (usually jre\lib\security).
syntax can be found at http://java.sun.com/j2se/1.3/docs/gu...licyFiles.html
some comments on applet security can be found at http://www.javaworld.com/javaworld/j...-security.html
but you only can change the policy for your computer. if you put your applet online, other users will have their own policys (which you can't modify) and thus will not be able to read/write from filesystem.
06-16-2006, 07:43 AM
graviton
easier way is to make an application from your applet.
06-16-2006, 10:17 AM
bobthesmiley
Well I don't know how to make an application, nor do I have the intention. However, I did find a tutorial at http://java.sun.com/developer/techni...curity/Signed/ for applets. I tried following it, but it seems my computer can't find the command 'keytool', along with several other vital commands. Why is this?
06-16-2006, 10:43 AM
graviton
keytool is located in the jdk\bin folder. perhaps you didn't configure the PATH variable properly.
06-16-2006, 09:12 PM
bobthesmiley
I got keytool to work eventually. For enabling file access I made a jar file of my project, and ran "keytool -genkey" to make a key thingy. Then I ran "keytool -selfcert" to make the certificate and then -jarsigner to sign the jar file with the certificate. However, this still does not let it open the file. Why is this?