🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #8586

Re: Change the directory permissions in Java

#8586
From: Dillan Fernando
Date: Fri, 09 Mar 2001 22:24
37 lines
2106 bytes
Hi Guys,

Thanks for the prompt replies....

> > no, java.io.FilePermission will not change the *OS's* directory
> > permissions, which is what Dillan was looking for.
> > Rather FilePermission controls the VM classes' access to a
> > file or directory (SecurityManager).

Yes, java.io.FilePermission does not work, I looked at some javadocs, and
found that I can't use it to change the file permession.


> > AFAIK there is no way to do this with stock-Java.
>
> In that case, I'd revert to something like:
>   Runtime.exec("/bin/chmod --reference=../$dir $dir");
>

Well.. I want to avoid Runtime.exec(), because I don't want to have any OS
dep. code in my app. I was thinking of using this if all fails.

What I did was to change the umask to 000 in the shell, that runse the VM.
This make the dir that my java code creates, 777.

Thanks for your help..

Regards


--
Dillan Fernando
ThoughtShare Communications Inc.
Software Developer
Email: dillan@thoughtshare.com <mailto:dillan@thoughtshare.com>
Tel: (604) 873-8724
Fax: (604) 873-8772
Technical Details
Message-ID: <98bl2e$hp31@bornews.inprise.com>
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!news-out.usenetserver.com!news-out-sjo.usenetserver.com!newsfeed.direct.ca!look.ca!hub.org!hub.org!PeerFeed.KWeb.on.ca!bornews.borland.com!not-for-mail
References: <989cpp$qer8@bornews.inprise.com> <98akfi$7mk1@bornews.inprise.com> <3aa8db70$1_2@dnews> <98ank5$dab9@bornews.inprise.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,e3475c5e57d50c08
X-Google-Attributes: gidf74b3,public
X-Google-ArrivalTime: 2001-03-09 14:28:06 PST
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!news-out.usenetserver.com!news-out-sjo.usenetserver.com!newsfeed.direct.ca!look.ca!hub.org!hub.org!PeerFeed.KWeb.on.ca!bornews.borland.com!not-for-mail
From: "Dillan Fernando" <dillanfernando@yahoo.com>
Newsgroups: borland.public.jbuilder.java.language
Subject: Re: Change the directory permissions in Java
Date: Fri, 9 Mar 2001 14:24:09 -0800
Organization: Another Netscape Collabra Server User
Lines: 39
Message-ID: <98bl2e$hp31@bornews.inprise.com>
References: <989cpp$qer8@bornews.inprise.com>  <98akfi$7mk1@bornews.inprise.com> <3aa8db70$1_2@dnews> <98ank5$dab9@bornews.inprise.com>
NNTP-Posting-Host: s216-232-27-165.bc.hsia.telus.net
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2314.1300
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300