Link to home
Start Free TrialLog in
Avatar of prain
prainFlag for United States of America

asked on

Directory Permissions problem when using mkdir() of the File class

Hello,

I hava a Java application that creates directories using the mkdir() method of the File class. This is in UNIX. when the directory is created by madir() it has drwxr-xr-x permissions string by default. As you can see the user has r/w/ex permissions, and the group has only r/ex permissions and does not have 'write' permissions. Our requirement is, when this directory is created, we must give permissions to the group also for writing.

Since mkdir() defaults to drwxr-xr-x, how can I set the peremissions to be drwxrwxr-x so that the group will also have write permissions when the directory is created.

Thanks
prain
ASKER CERTIFIED SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of prain

ASKER

is'nt there a direct Java way of doing that?
No. Java is platform independent, so would have no platform-dependent way of altering file perms
Avatar of prain

ASKER

Ok. That' right. I will try this.
Avatar of prain

ASKER

OK. That works Great!.  Thanks.
:-)

Which way did you go in the end?
Avatar of prain

ASKER

I set the permissions using chmod 775  by Runtime.exe();