Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 288
  • Last Modified:

How to detect if directory is writible in JAVA

As the topic says.
0
Maranellas
Asked:
Maranellas
1 Solution
 
ArticCommented:
File f = new File("C://Documents and Settings//All Users//Documents");
    if(f.canWrite())
        System.out.println("The directory is writable");
    else
        System.out.println("The directory is not writable");
0
 
MaranellasAuthor Commented:
isn't it suppose to be backslash .forward slash is for unix systems only
0
 
afibarraCommented:
You can use:

File.separator

The system-dependent default name-separator character.
0
 
MaranellasAuthor Commented:
yes i already aware of that the thing is he gave incorrect solution apparently!
0
 
eitamaCommented:
"/" can work on windows as well,

I think he was focusing on your question,
He answer looks good in my opinion.
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now