• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

file read/write permissions

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, my question is:
In the server (or client) security policy file, do you have to give the db.db file a java.io.FilePermission setting?
I pass the location (as a full pathname) of the db.db file on the command line so that I can create a Data object. If I don't specify the full pathname of this file in the security policy file I get a 'java.security.AccessControlException: access denied (java.io.FilePermission..'
The problem is that the specification states 'allow the user to specify the location of the database', so if they move the database, the location will differ from the location in the policy file, and this exception will occur. Is there any way of setting policy file attributes after starting the program, or is there another way of making sure there is access to the file, wherever it is, without using 'permission java.security.AllPermission' which I don't think is a good idea.
please advise!
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I just put one permission in my policy file that gave full access to everything.
grant {
permission java.security.AllPermission "", "";
};

I didn't lose points for it.
Mark
 
John Mack
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Mark,
thanks for your reply. I have got a policy file now that basically allows all access to the files below the current user directory. But,if it goes pear-shaped it's good to know I can use the simple permission and not lose marks.
 
My pie came with a little toothpic holding up this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic