This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Applets and the fly likes does anyone use the .java.policy file? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "does anyone use the .java.policy file?" Watch "does anyone use the .java.policy file?" New topic

does anyone use the .java.policy file?

Norm Radder
Ranch Hand

Joined: Aug 10, 2005
Posts: 696
Am I the only one using .java.policy file to allow an applet to read files on my local disks? I'm able to have an applet in Firefox read/write a file, but in IE7 it fails.

Any recommendations on how to debug/trace it so I can get it to work?

Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
The first step would be to make sure that the policy file that contains your modifications is being used at all. Maybe create a new Permission class, require that in the applet, but don't add it to the file. Then the applet should fail.

Or comment out some of the permissions that were in the file before, and make sure that the applet fails where those are required.

Once you know the file is being used you can work on the individual permission you actually want to add. I seem to recall seeing a discussion recently that implied different browsers didn't recognize quite the same policy file syntax (which doesn't make much sense, as it's the JVM doing the interpreting, but it was being claimed).
Norm Radder
Ranch Hand

Joined: Aug 10, 2005
Posts: 696
Thanks for the response.
I've asked questions on this problem from several points of view. You probably saw some of them.
The .java.policy file has been working for years with some browsers. It works for IE7 if the file to be writtten is fully referenced, but not with the - or * wildcard.
It seems that IE7 must have a different Security Manager.

The only techniques I've seen are what I call the shotgun method, try every possible combination until you find the one that works. No way to trace the Security manager to see what it needs or what it doesn't like.
I agree. Here's the link:
subject: does anyone use the .java.policy file?
It's not a secret anymore!