commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chetan" <>
Subject Need help in java code - Write into Text file
Date Tue, 10 Jan 2006 10:10:00 GMT

I am chetan from India, I have developed the WebSite I am encountering
a serious problem in writing into a text file. I am unable to configure the path of the text
file. while using Linux i got it. but now i am using Windows Environment. The code is as follows.

public String ewrite(String str)
  String err = "File updated";
    Date d = new Date();
    BufferedWriter bwout = null;
    // for Web Server 
      //BufferedWriter out = new BufferedWriter(new FileWriter("/home/bhavishya/ErrorLog.txt",
true)); // For Linux
      bwout = new BufferedWriter(new FileWriter("./bhavishya/logs/ErrorLog.txt", true));
      bwout.write(d.toLocaleString()+" : "+str+"\n");
    catch (RuntimeException e1) {err = e1.toString(); e1.printStackTrace();}
    System.out.println("ErrorLog - 21");
  catch (IOException e) { System.out.println(e); }
  return err;


BHAVISHYA is a premier futures broker with over 115 commodity traders in 8 offices to service
all of your indian and international commodities, alternative investments, trading needs,
day trading, futures brokers, futures trading, forex trading, currency trading, managed futures,
stock trading, share trading, and personalised Portfolio Management.
Log on to for further details.
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message