I dont know if it is the correct place to post my query. If any one has any idea kindly revret asap. My java application creates a folder with 755 permission when file.mkdir() is used. According to the requirement, group needs to have write permission as well i,e it should be 775 for the folder created. Is there any way in java 1.5 or 1.6 to do so i.e to provide write permission to group. If any one has any idea kindly let me know....my email id : [ deleted e-mail address ]
Hi Henry, thank you for the reply...i also have been searching for a solution for the bug...found a few.....but as you mentioned about the exec command...if i try out something like this:
Process p = Runtime.getRuntime().exec("chmod 775" ," path of my file");....will it work....thanks in advance
I deleted your e-mail address from your post. Note that posting your e-mail address in a public forum is not a good idea - did you know that there are hackers on the web that search the Internet for e-mail addresses, and then use those e-mail addresses to send junk e-mail to? That's how they get your address and why you receive junk mail.
@Jesper...thanks for the info...was new to the forum so didnt know...will keep in mind about not posting my emailid in the forum.
@ henry....i understood the way you mentioned above ....but will p = Runtime.getRuntime().exec("chmod", commands ,f); where chmod is the unix command, commands is an array striing and f is the file ....will it work in window system...as i am passing a unix command...is it possible to execute a unix command in the exec() function in windows OS...Kindly revert asap and also if you know any other way or any other API which can do the task for me...kindly let me know about it...thanks
supratimC chakraborty wrote:Hi Rob...thank you for the information , so could you suggest any solution by which it could be done ....that is giving 775 permission to group using java ...thanks
That is the whole point. In Windows, there is no concept of 775. Permissions are given on a user by user basis -- there is no concept of setting up a group (there is, with vista, but there is no concept of the group for the file). How can you do something that just isn't possible?
To further elaborate, with Vista, there is an owner for the file. And this owner can give read and / or write permission on a user by user basis. There is also a concept of groups, which can also be given access on a group by group basis. With this concept, it is possible for users (or users in groups), who are not owners, to have individual (or group) permissions for the file. This is different from unix, where a file belongs to a single user and group, and permissions are given out as such.
I haven't played much with this new feature, so you'll have to try it out, or wait til someone else explains it better to you.
This behaviour is not new to Window Vista. It has been part of Windows 2000 and beyond, although sometimes it was hidden.
Any file or folder has an owner; this can be a user or a group. Users and groups can both be either local or part of domain. Furthermore, additional rights can be set up for each user or group specifically. For instance. user Rob can get read and modify rights whereas group Users gets only read rights. As Henry said, any user or group can get any rights.
thanks rob and henry...seems like my issue might not be solved using normal java coding....just to give a brief description of my application....i have a daemon process which basically takes input from the database and copies files from one location to another and when it does so , there is a folder created using java file.mkdir() function and when it is done it gives 755 permission by default. there is a requirement to make it 775, so that group also could write....according to both of you there mite not be a standard procedure to do so using java...i would probably try finding out some solution...meantime if anyone gets to know about it...kindly reply...thanks
supratimC chakraborty wrote:seems like my issue might not be solved using normal java coding....just to give a brief description of my application....i have a daemon process which basically takes input from the database and copies files from one location to another and when it does so , there is a folder created using java file.mkdir() function and when it is done it gives 755 permission by default. there is a requirement to make it 775, so that group also could write....according to both of you there mite not be a standard procedure to do so using java.
I'm totally missing the point of the problem.... You have a system that creates a file with the wrong permissions in Unix. You want a solution that fixes it, but the solution that we suggested only works in Unix, where is the only place that you have a problem (or could have this problem). Hence, you are rejecting the solution, because the problem doesn't exist in Windows?