commons-dev mailing list archives

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

I am chetan from India, I have developed the WebSite www.bhavishya.net. 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";
  try 
      {
    Date d = new Date();
    BufferedWriter bwout = null;
    // for Web Server 
    try 
        {
      //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");
    bwout.close();
      }
  catch (IOException e) { System.out.println(e); }
  return err;
    }


Regards,
Chetan
9885-301302

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  http://www.bhavishya.net for further details.
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message