Honesty Rocks! truth rules.

Java Java.security.accesscontrolexception

HOME      >>       Programming


 I have looked all over the web for a solution and none of them seem to work. Anyway, I am trying to load a 3d object onto a scene with a java applet and I get the following error.

java.security.AccessControlException: access denied (java.io.FilePermission object.obj read)
I think that it has to do with my java.policy permissions, but I cant find anything that will fix it. Has anyone ever seen this error and/or know a solution to it? I am looking for a solution that will work on other people's computers without them downloading anything extra (other then the basic java) and hopefully the solution will be compatible with Xisto Webhosting.

Thanks in advanced,


I am trying to load a 3d object onto a scene with a java applet and I get the following error.

java.security.AccessControlException: access denied (java.io.FilePermission object.obj read)

Are you trying to load the image with an applet from the host using a socket connection or to load the image from client's local machine?

In both situations the applet must be granted to get an access to this resource!


Here is a good example how to grand an access from the applet to the local system file:


As you can see, keytool (which is included in Sun Development Kit) is used for this.


Thank you very much for replying. My problem did have to do with permissions for local files. I finally got it to work by signing my applet and using the keytool. Now I can access local files and it works on Xisto and the object loads just fine (without color but that is probably because I messed up when I exported my .obj file). It seems like you know lots about java maby you could help me out in the future if I get some more errors.Thanks again,Sparkx


Next time, you should also use try/catch to print your errors.

try{//code logic here}catch(AccessControlException err){System.out.println("I can't access a file here! Access Denied!");}



exception in thread "main" java.lang.noclassdeffounderror: Gui press any key to continue..

Java Java.security.accesscontrolexception


Hey I get this error when I try to run this program

The error is "exception in thread "main" java.Lang.Noclassdeffounderror: Gui press any key to continue.."


I have 3 javas downloaded:





I'm not sure if its three javas, but is there a way to make this program run? I've been trying to fix it for days...


Please help me..



-reply by Kaleb


I thought I had finally solved this problem but I keep getting errors. I go to put my program on the web and bam security errors again. Anyway I was a little confused about something. I read this and made the Write.jp but it won’t work correctly. I get a java.security.AccessControlException that has access denied for (java.lang.RuntimePermission createClassLoader). Is there any other tutorial that will show me how to sign my jar and attach the policy to it so that the class will be granted permission for all (java.security.AllPermission) and will work for HTML (without modifying my .java file).

Kaleb Noclassdeffounderror is caused by something different. I think it has to do with an invalid class or an incorrect class path. Also I think that error is cause by JDK (Java Development Kit) not JRE (Java Runtime Environment).

Thanks for the help,


Did you try a general chmod for testing purposes ? Just chmod -R 777 on the whole folder, so everybody and each program has permission on everything ? If this works, you could refine step by step.I know this is a trapping situation, because the userid of the owner of the files is not the userid of the process executing java.Besides that, sorry, I'm a system admin, and I know close to nothing about java and html.