File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Applets and the fly likes AccessControlException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "AccessControlException" Watch "AccessControlException" New topic


YuenLian Wu
Ranch Hand

Joined: Nov 16, 2005
Posts: 73
Hi all,

I have an java applet program that will use java IO to read and write local file. I know I need to grant rights to the client from "java.policy" file in order to bypass this( access denied ( c:\item.txt write)) exception. I am currently using IBM WSAD 5.1.2 to write my applet code. I put the following code inside java.policy file(s), where BookStore folder contains all of my java files, and I would like to have to access right to read and write to the client's local files.

since IBM WSAD has a few java.policy files, and I am currently using their base_v5 library, so i modified all the java.policy under "$IBMWSAD"\eclipse\jre\lib\security\java.policy",
and also create ".java.policy" using command "policytool".

However, what I did is vain and the applet from the "sun java console" still gives me access denied ( c:\item.txt write) when I try to write some data to the file. why? what's wrong with my work? I really feel fraustured at it and I hope I can get help from you guys

THanks in advance

Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
Those two paths look like they have something to do with WSAD, which may not be the same JVM that is being used to run applets. (I would imagine that WSAD likes to use an IBM JVM, while your posts talks about the "Sun Java console".)

Check the Java Plugin control panel for which JVM is used for applets, and put the policy file in its repective directory.
I agree. Here's the link:
subject: AccessControlException
It's not a secret anymore!