Win a copy of Head First Android this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

access denied java.io.FilePermission

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!!!
 
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Mari Wessels
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks! Removed the codebase line from the policy file and it worked a charm.
Mari.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic