Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / April 2007

Tip: Looking for answers? Try searching our database.

FileWriter and Path

Thread view: 
Stefan.Jia@googlemail.com - 04 Apr 2007 12:18 GMT
Hello,

i use FileWriter to write content into a file, the fileName contains
path and file name, however, the path (folder) does not exist:

test/test.txt (the folder "test" does not exist yet)

new FileWriter(fileName) throws an exception.

I don't want to create the folders manually, since there are too many
folders to be created.

thanks!

regards,
schuen
Andrew T. - 04 Apr 2007 13:11 GMT
>Hello,

G'day.

>i use FileWriter to write content into a file, the fileName contains
>path and file name, however, the path (folder) does not exist:
[quoted text clipped - 5 lines]
>I don't want to create the folders manually, since there are too many
>folders to be created.

Uh-huh. ..Let us know how that goes,
and feel free to pop back by if you have
any questions.

As a general tip, I strongly recommend using
the File(File, String) constructor to build deep
(or any) paths.  Obviously, an easy way to get
there is to loop through an array of strings
representing the directory names.

This seems to be almost exactly what you
do not want to do.

>thanks!

No worries!

(As an aside, every sentence should start with
an Upper Case letter.  Using caps. at the right
places, helps the reader.)

Signature

Andrew Thompson
http://www.athompson.info/andrew/



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.