• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

file read/write permissions

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • 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: 17346
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
  • 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
  • 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.
 
There are 10 kinds of people in this world. Those that understand binary get this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic