my dog learned polymorphism*
The moose likes Java in General and the fly likes Not able to create directory Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Not able to create directory" Watch "Not able to create directory" New topic
Author

Not able to create directory

Kaustubh G Sharma
Ranch Hand

Joined: May 13, 2010
Posts: 1270

I am trying to create a direcorty from the code below



but not able to generate directory from this .....result-> file not found exception.... please help me out

Thanks
Kaustubh


No Kaustubh No Fun, Know Kaustubh Know Fun..
Mohamed Sanaulla
Saloon Keeper

Joined: Sep 08, 2007
Posts: 3064
    
  33

You can use pathSeparator field from the File class for adding path separator.

Can you provide the stack trace?



Mohamed Sanaulla | My Blog
Kaustubh G Sharma
Ranch Hand

Joined: May 13, 2010
Posts: 1270

done it but still not creating it my update code is shown below




or


Wouter Oet
Saloon Keeper

Joined: Oct 25, 2008
Posts: 2700

File.html#mkdir() Returns: true if and only if the directory was created; false otherwise

So you should check the result of that method.


"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
Mohamed Sanaulla
Saloon Keeper

Joined: Sep 08, 2007
Posts: 3064
    
  33

So you want to create a directory and then a file within that? And you are using mkdir()?
Kaustubh G Sharma
Ranch Hand

Joined: May 13, 2010
Posts: 1270

yeeppyyyy

I tried the code below and it is working fine ....I think it is not permitting me to create more than one directory at a time ..

check this out...

Kaustubh G Sharma
Ranch Hand

Joined: May 13, 2010
Posts: 1270

my job is to create a directory within a directory and when I have the file name than want to put that file under it.. hope you got it right...thanks for your kind help


Kaustubh
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10167
    
    8

Kaustubh G Sharma wrote:...I think it is not permitting me to create more than one directory at a time ..

File#mkdirs()


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Mohamed Sanaulla
Saloon Keeper

Joined: Sep 08, 2007
Posts: 3064
    
  33

Maneesh Godbole wrote:File#mkdirs()


This is really useful info. Without reading about the method- I had assumed that it would create multiple directories in the same location. Thanks Maneesh!!
Kaustubh G Sharma
Ranch Hand

Joined: May 13, 2010
Posts: 1270

Thanks All
 
 
subject: Not able to create directory
 
Similar Threads
reusing File reference not working
read/write files from Tomcat web.xml?
PATH variable doubt.
Creating directories
File Permissions