• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Create a new file and write to it else append to it

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi I am using DOM to make an xml tree and writing it to a file.

I have declared the fileName:

String fileName = "/tmp/memberFile";

to save it to the file i have done the following:

File membersXMLFile = new File(fileName);
FileWriter writer;

if (!(membersXMLFile.exists()))
{
writer = new FileWriter(membersXMLFile);
}
else //file does exist
{
writer = new FileWriter(membersXMLFile, true);
}


if file does not exist FileWriter writes to file. else if it does exist, file writer writes to the file by appended to the file.

However, i am still getting a TOMCAT Error. As this is java code. I am confused on what is wrong with my code.

Please Help
Sana
[ October 15, 2004: Message edited by: Sana Ali ]
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It would help if you'd tell us what kind of Tomcat error you're getting?
Also, how is this related to XML?
 
reply
    Bookmark Topic Watch Topic
  • New Topic