aspose file tools*
The moose likes Java in General and the fly likes Filewriter File permission Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Filewriter File permission" Watch "Filewriter File permission" New topic
Author

Filewriter File permission

Meet Gaurav
Ranch Hand

Joined: Oct 08, 2008
Posts: 492
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

Joined: Sep 11, 2006
Posts: 959

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.


SCJP 5.0, SCWCD 1.4, SCBCD 1.3, SCDJWS 1.4
My Blog
Meet Gaurav
Ranch Hand

Joined: Oct 08, 2008
Posts: 492
Sorry, Our weblogic JVM version is 1.5. Please give a alternate way..
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19783
    
  20

You can either use JNI, or use ProcessBuilder to execute the chmod command on your file.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Filewriter File permission