Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Filewriter File permission

 
Meet Gaurav
Ranch Hand
Posts: 492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

Am just creating a new file using the below code. But it’s creating the file with permission “rw-r------”

But I need “rw-r-r-----”

Please help me to change the permission


 
Freddy Wong
Ranch Hand
Posts: 959
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's defined by the umask. You can either change the umask or if you aren't allowed to do that, you can call File.setReadable(true, false) after creating the file.
 
Meet Gaurav
Ranch Hand
Posts: 492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, Our weblogic JVM version is 1.5. Please give a alternate way..
 
Rob Spoor
Sheriff
Pie
Posts: 20526
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can either use JNI, or use ProcessBuilder to execute the chmod command on your file.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic