• Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem Creating Directory  RSS feed

 
Paul Peterson
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know I'm missing something stupid. 

I took this code from one project and it works as expected:



But when I try to change the path variable to


The directory is not created. 

Sorry for asking such a stupid question, but I don't understand why the code fails just by changing the path name.
 
Carey Brown
Saloon Keeper
Posts: 3328
46
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does the directory already exist?
Does the path refer to a file and not a directory?
 
Paul Peterson
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The DVD directory does not exist at the moment.  The Vending machine directory does exist.  I have deleted the Test folder to see if the mkdir works.  The path is just referring to the directory name at the moment, the filename will be added shortly.
 
Liutauras Vilda
Sheriff
Posts: 4927
334
BSD
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try method mkdirs(), so it woud create parent directory/-ies too.
Java API wrote:public boolean mkdirs()
Creates the directory named by this abstract pathname, including any necessary but nonexistent parent directories.
 
Paul Peterson
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
THANK YOU!!

I knew I was missing something small!

 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!