wood burning stoves 2.0*
The moose likes Applets and the fly likes Does anyone use the .java.policy file to give applets permission Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "Does anyone use the .java.policy file to give applets permission" Watch "Does anyone use the .java.policy file to give applets permission" New topic

Does anyone use the .java.policy file to give applets permission

Norm Radder
Ranch Hand

Joined: Aug 10, 2005
Posts: 685

I'm having trouble getting a codebase to work for an applet run from a jar file in some browsers: FF3.6.3, Chrome and IE8. The applet works in Older versions of Mozilla.
The applet reads and searches files in a folder and sub folders.

The applet works if I add a permission allowing all files to be read to a grant that doesn't have a codebase (ie for all codebases).
grant {
/* permission java.io.FilePermission "<<ALL FILES>>", "read"; This WORKS!!! Testing ONLY */

I have another entry in the policy file that allows a test applet to read a file. That entry allows ALL of my browsers to read the test file. I've tested by commenting out the entry, get the access denied message and then uncommenting it and having it work.
grant codeBase "file:/D:/JavaDevelopment/-" {
permission java.io.FilePermission "<<ALL FILES>>", "read"; /* For AppletReader Test */
permission java.util.PropertyPermission "*", "read, write";

Does anyone have examples of codebase= entries that work with current versions of browsers?

My JRE version info:
Java Plug-in 1.6.0_20
Using JRE version 1.6.0_20-b02 Java HotSpot(TM) Client VM

I have posted this question on Sun's site:

I posted a similiar question here two years ago:
and 5 years

Rob Spoor

Joined: Oct 27, 2005
Posts: 19654

Moving to our Applets forum.

How To Ask Questions How To Answer Questions
I agree. Here's the link: http://aspose.com/file-tools
subject: Does anyone use the .java.policy file to give applets permission
Similar Threads
java.policy grant codeBase
file permissions
applet security exception
Browsers and jre plugins for applets
Using Policy File