aspose file tools
The moose likes Java in General and the fly likes making a file directory in java Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "making a file directory in java" Watch "making a file directory in java" New topic
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
    
  13

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
    
  13

Yes, that's right.
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 16681
    
  19

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)
 
I agree. Here's the link: http://zeroturnaround.com/jrebel/download
 
subject: making a file directory in java
 
Similar Threads
tomcat - read external properties file from jar
Modify build xml to replace words in an xml or properties file based on a text file
Read and Parse DTD doctype XML file from jar
Directory / File not found
delete files in a driectory