Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Wrestling with access control security

 
J Ellis
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I have an applet that calls a bunch of pojos to eventually read in image files and display them. I had everything working on my old machine but rebuild when my hard drive went bad, and I cannot remember how to get around the access control to read a file on the local machine. Even though I have self-signed the .jar file, I keep getting a java.security.AccessControlException: access denied ("java.io.FilePermission"... error. I believe the self-signing works because if I use the .jar file before I sign it I get a different error (java.security.AccessControlException: access denied ("java.util.PropertyPermission" "com.sun.media.jai.disableMediaLib" "write")). The jarfile contains a policy file granting all permissions in its root, but at this point I can't even remember if I was using a policy file before or not.

I checked out http://www.coderanch.com/how-to/java/HowCanAnAppletReadFilesOnTheLocalFileSystem on here, but it says that if a jar file is signed then it should have full permissions. What am I doing wrong here?

Would someone kindly point me in the right direction?

Thanks!
 
Haina Minawa
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
J Ellis wrote:Hi all,

I have an applet that calls a bunch of pojos to eventually read in image files and display them. I had everything working on my old machine but rebuild when my hard drive went bad, and I cannot remember how to get around the access control to read a file on the local machine. Even though I have self-signed the .jar file, I keep getting a java.security.AccessControlException: access denied ("java.io.FilePermission"... error. I believe the self-signing works because if I use the .jar file before I sign it I get a different error (java.security.AccessControlException: access denied ("java.util.PropertyPermission" "com.sun.media.jai.disableMediaLib" "write")). The jarfile contains a policy file granting all permissions in its root, but at this point I can't even remember if I was using a policy file before or not.

I checked out http://www.coderanch.com/how-to/java/HowCanAnAppletReadFilesOnTheLocalFileSystem on here, but it says that if a jar file is signed then it should have full permissions. What am I doing wrong here?

Would someone kindly point me in the right direction?

Thanks!


Do you create a new SecurityManager in your applet? I got the similar problem and solved it by setting the security manager to null.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic