• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

How do I create a Data folder in my C: Drive using my Java program

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My assignment requires that I use exception handling to create a directory and file if necessary.

I was able to create a C:Data\inventory.dat file, provided that there's an existing Data folder (directory) in my C: drive; however, I have a feeling that the assignment wants me to create an actual Data folder if one is not available. When I remove the Data folder from my C: drive, I get "C:\data\inventory.dat (The system cannot find the path specified)".

How am I to create able a folder that currently does not exist? I'm reading the java.sun website on the File class, the mkdirs methods, and the FileSystemView class; however, I'm having trouble implementing the requirements in my code (I wish API documentation was more understandable to me.). Can an example be provided? Thank you everyone.





 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please don;t post the same question in multiple forums.

Dave
 
Paper jam tastes about as you would expect. Try some on this tiny ad:
Enterprise-grade Excel API for Java
https://products.aspose.com/cells/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!