🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #1214

filepermission

#1214
From: Sven Goetgeluck
Date: Wed, 18 Feb 2004 12:54
25 lines
1529 bytes
Hi,
I want to check wether i can write in a directory
using following codesnippet

try {
         String curDir = System.getProperty("user.dir");

        AccessController.checkPermission(new FilePermission("C:\\tempie\\-",
"read"));
        System.out.println("Writing and reading permission on :"+ curDir);



        // Has permission
    } catch (SecurityException e) {
      String curDir = System.getProperty("user.dir");
       System.out.println("No writing or reading permissions on "+ curDir);
        // Does not have permission
    }


But allways throws the exception what can be wrong?
even if i use the curDir string it goes wrong

Sven
Technical Details
Message-ID: <40336098@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed.iinet.net.au!newsfeed.iinet.net.au!PeerFeed.KWeb.on.ca!news.kweb.on.ca!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,99a385e7ef7e0ba,start
X-Google-Attributes: gid111d45,public
X-Google-ArrivalTime: 2004-02-18 05:05:27 PST
From: "Sven Goetgeluck" <sven.goetgeluck@pandora.be>
Newsgroups: borland.public.jbuilder.java.swing
Subject: filepermission
Date: Wed, 18 Feb 2004 13:54:46 +0100
Lines: 27
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 217.136.183.76
Message-ID: <40336098@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1077108888 217.136.183.76 (18 Feb 2004 04:54:48 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed.iinet.net.au!newsfeed.iinet.net.au!PeerFeed.KWeb.on.ca!news.kweb.on.ca!newsgroups.borland.com!not-for-mail