Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Java file permission on Unix

Status
Not open for further replies.

Madere

Technical User
Apr 14, 2003
85
GB
Hi, I have a question about setting file permissions on a Unix system.

I am using the File.createNewFile() methode to create a new file in a Directory. The directory is created using File.mkdirs().

The file/directory must be created using the permissions of the user. But for some reason it does not happen. How can I change the permission of a file to: "rwx" for the user, "r" for the group and "r" for the world/others.

As mentioned: for some reason the permissons defined for the user won't work.

Which java class/methods to call and what are the parameters?

Kind regards and thanks in advange,

Madere.
 
You can always use System.exec() to run a chmod command, but that will just work in Unix.

Cheers,

Dian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top