• 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

change the file permission mode

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello all,
Could someone help me?
In a Java application, I would like to change a file permision from readable to writtable , then in later part of the application, I want to change it back to readable. How can I make these changes in Java application.
I though about using the policy file before, but once the policy is used, you cannot change and use different policy file in a single application.
What is the good solution for changing the file permission mode?
Thanks for any comment.
 
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You could use the policy file, you have to ensure the setSecurityManager and createSecurityManager permissions are granted. Then when you need to access the file you create the permissions needed, and when your done, again set the manager back. This only controls permissions for java applications using that policy file. If you're trying to prevent other applications and users from changing the file, try using Runtime exec() to execute chmod or attrib based on the system your on.
Hope this helps
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic