Hello all,
This is my first time posting on the forums, but I'm sure I will be a regular poster pretty soon as I'm very much involved in Java Programming now.
I'm new to Java, but not new to programming, so I was a bit suprised when I had this issue. I have also googled the problem and had a lot of hits, but nothing that has solved the issue.
I'm trying to write to a text file, some lines of data. Its for an email conversion program. I'm using Rational Application Developer for WebSphere. When I run the code, the text file is empty. Here is the code:
try { PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(strFileName))); EmailItem emailItem = emailConv.convertStreamToEmailItem ( new FileInputStream("test.dxl"), "test", ".\\"); out.println("FROM: " + emailItem.getFrom()); out.println("TO: " + emailItem.getTo()); out.println("CC: " + emailItem.getCc()); out.println("BCC: " + emailItem.getBcc()); out.println("SUBJECT: " + emailItem.getSubject()); out.println("BODY: ### " + emailItem.getBodyHtml() + "###"); out.close(); } catch (Exception e) { e.toString(); e.printStackTrace(); }
I have tried not using bufferwriter, I have also tried flushing, although close() does do a flush anyway, I'm completely at a loss, whatever I do, nothing is written to the text file.
Any idea's? Thanks in advance,
Darren