File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes access denied  java.io.FilePermission 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 » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "access denied  java.io.FilePermission" Watch "access denied  java.io.FilePermission" New topic
Author

access denied java.io.FilePermission

Mari Wessels
Greenhorn

Joined: Jun 19, 2002
Posts: 10
Hi!
I'm trying to get my RMI to work. I have a policy file which grants all permissions, looks like this:
grant codeBase "http://marie:1099/Developer/scjd/starting/-" {
permission java.security.AllPermission;
permission java.io.FilePermission "<<ALL FILES>>", "write, read, delete, execute";
permission java.security.SecurityPermission "getPolicy";
permission java.security.SecurityPermission "setPolicy";
permission java.io.SerializablePermission "enableSubclassImplementation";
permission java.io.SerializablePermission "enableSubstitution";
permission java.net.SocketPermission "marie:1099-", "accept, connect, listen, resolve";


};
It sits in my jdk bin, yet I still get a write exception, saying I don't have access to write. The file exists and I can read it, but I can't write to it (tested for that.)
Anybody have any ideas? I'm pretty desparate here!!!


SCJP2<p>"Don't be afraid to try something new, remember amatuers built the ark, professionals built the Titanic!"
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Hi Mari,

grant codeBase "http://marie:1099/Developer/scjd/starting/-" {
permission java.security.AllPermission;
permission java.io.FilePermission "<<ALL FILES>>", "write, read, delete, execute";
permission java.security.SecurityPermission "getPolicy";
permission java.security.SecurityPermission "setPolicy";
permission java.io.SerializablePermission "enableSubclassImplementation";
permission java.io.SerializablePermission "enableSubstitution";
permission java.net.SocketPermission "marie:1099-", "accept, connect, listen, resolve";

};

If you want your policy file to grant full permission why don't you just do this:



It sits in my jdk bin, yet I still get a write exception, saying I don't have access to write. The file exists and I can read it, but I can't write to it (tested for that.)

How does your application know to use it? You should include it on the command line like this:

Hope this helps,
Michael Morris


Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
Mari Wessels
Greenhorn

Joined: Jun 19, 2002
Posts: 10
Thanks! Removed the codebase line from the policy file and it worked a charm.
Mari.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: access denied java.io.FilePermission
 
Similar Threads
java.security.AccessControlException: Access denied issue
Ignorant RMI question??? Design choice
RMI Server Connection Problem on XP prof
file permissions
why security manager doesn't work?