| Author |
making a file directory in java
|
kay lin
Ranch Hand
Joined: May 20, 2004
Posts: 132
|
|
Hi all: I would like to make a file direcotory in Java, so I did was the following C:\\jbproject\\AJJavaModelApplicationOCT7.bkp\\JavaModelApplicationAAAEJB\\META-INF\\ is the name of the directory I want, but when i run the program, it is not making the file directory..can somebody let me know what I am doing wrong?? Thanks
|
 |
Ernest Friedman-Hill
author and iconoclast
Marshal
Joined: Jul 08, 2003
Posts: 24043
|
|
That looks OK, assuming that all the directories but the META-INF one already exist. Are you sure you typed that nasty pathname correctly? You might try printing the value of new File("C:\\jbproject\\AJJavaModelApplicationOCT7.bkp\\JavaModelApplicationAAAEJB\\").exists(); it should print "true". If not all the directories already exist, you need to create them one at a time from the top down.
|
[Jess in Action][AskingGoodQuestions]
|
 |
kay lin
Ranch Hand
Joined: May 20, 2004
Posts: 132
|
|
Originally posted by Ernest Friedman-Hill: That looks OK, assuming that all the directories but the META-INF one already exist. Are you sure you typed that nasty pathname correctly? You might try printing the value of new File("C:\\jbproject\\AJJavaModelApplicationOCT7.bkp\\JavaModelApplicationAAAEJB\\").exists(); it should print "true". If not all the directories already exist, you need to create them one at a time from the top down.
I see..I think i might know what my problem is... the \\JavaModelApplicationAAAEJB\\ doesnt exit so I guess I will have to create that directory first..and then the \\META-INF\\ correct? plz let me know many thanks
|
 |
Ernest Friedman-Hill
author and iconoclast
Marshal
Joined: Jul 08, 2003
Posts: 24043
|
|
|
Yes, that's right.
|
 |
Henry Wong
author
Sheriff
Joined: Sep 28, 2004
Posts: 16681
|
|
If I remember correctly, there is also a mkdirs() method that will create all the directories in the path. Henry
|
Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
|
 |
 |
|
|
subject: making a file directory in java
|
|
|