There are some methods provided in java.io.File, such as canRead() and canWrite(), which help in telling whether a file is readable or writable. But I did not find any API which tells whether a file is 'executable'. Also, I presume the methods above pull up the permissions pertaining to the owner of the file, but not for the group and others part of a Unix File's permissions.
Is there a way to pull up the read/write/executable permissions for all the 3 catergories namely, UserPermissions, GroupPermissions and Others'Permissions.
I appreciate your note on this and appreciate your time too.
I don't think you can do this without native code. It wouldn't be hard to do the JNI for it, though.
The canRead() and canWrite() methods, as far as I know, return a flag indicating whether the Java program can read or write the file. That does not map directly to any of the three sets of permissions in Unix.
Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
Joined: Sep 04, 2003
Thanks for the reply. Can you tell me exactly how to use JNI to invoke Unix Shell scripts? All I have seen is that JNI can be used to invoke C/C++ code, but could not find how to use JNI in conjunction with Shell scripts. Do you have any clue? Currently I have a script which pulls up the 'rwx' permissions of a file, I want to invoke this script from my java program to get things going. Can you suggest anything to fix this one?