Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8310619
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T19:31:30+00:00 2026-06-08T19:31:30+00:00

How do you check if the application has permission to read or write to

  • 0

How do you check if the application has permission to read or write to specific directories on the filesystem. I am trying this:

try {
    AccessController.checkPermission(new FilePermission(files[i]
            .getAbsolutePath(), "read,write"));
}
catch (Exception e) {
    System.out.println(e.toString());
}

but it always throws the exception and outputs:

java.security.AccessControlException: access denied ("java.io.FilePermission" "C:\Dell" "read")
java.security.AccessControlException: access denied ("java.io.FilePermission" "C:\Documents and Settings" "read")
java.security.AccessControlException: access denied ("java.io.FilePermission" "C:\glut-3.7.6" "read")

Is there something I’m missing here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T19:31:32+00:00Added an answer on June 8, 2026 at 7:31 pm

    Seems that AccessController always throws an exception when you don’t have permission. You can handle this by catching SecurityException.

    Better solution to check read/write permission with java.io.File.canRead(), java.io.File.canWrite() methods.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to check whether user has installed my application or not. The flow
Is there a way to check if an application has finished loading. For example
Background : my application has the option to check automatically whether a device on
I want to check if the window of an external application has the vertical
I was trying to run my application and check for some output on the
I am building a simple C# application that has to write the user input
is there a way to check in my application (canvas) if the user has
I am trying to get users' permission for 'offline_access' in an iFrame Facebook application
I found a code that should check wether the application is offline and has
I'm programming a new application with many users, a few roles and specific permissions

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.