• Post Reply Bookmark Topic Watch Topic
  • New Topic

Making new directories  RSS feed

 
Barry Andrews
Ranch Hand
Posts: 529
C++ Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I am having some trouble making directories using File class.
Can someone help please?
Here is my code:


I am having no trouble if I save to a file such as "Filename.java" ,but if I am also trying to create a new directory I get an IOException 'FileNotFound'. I have even tried putting the fully qualified path, and that does not work either. Can someone tell me what I am doing wrong? Many thanks!!!
Barry
 
Matt Siegel
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No where in your code are you calling File.mkdir(). How are you trying to create a new directory?? File.createNewFile() will not create a directory, just a file.
Matt
 
Barry Andrews
Ranch Hand
Posts: 529
C++ Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have also tried mkDir() on the line that says "newFile.createNewFile()", and that also did not work. Is there something else I need to do.

Thanks,

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