read/write to .ini file
807600Jul 18 2007 — edited Sep 6 2007confusion on .ini file
I have a .ini file as such:
StartDate=5/27/2006
LastRunDate=6/18/2007
[OutputDirectory]
LogPath=C:\Me
When I run this code:
import java.util.*;
import java.io.*;
public class readIni {
public static void main(String[] args) {
readIni ini = new readIni();
ini.doit();
}
public void doit() {
try {
Properties properties = new Properties();
properties.load(new FileInputStream("user.ini"));
String string = properties.getProperty("LogPath");
properties.setProperty("LogPath", "test");
properties.store(new FileOutputStream("test.ini"), null);
} catch (IOException e) {
}
}
}
I get the output as such:
#Wed Jul 18 11:01:53 PDT 2007
[OutputDirectory]=
LogPath=test
LastRunDate=6/18/2007
StartDate=5/27/2006
I want it to appear as such:
StartDate=5/27/2006
LastRunDate=6/18/2007
[OutputDirectory]=
LogPath=test
Why do I get the output all mixed up and the add-in date information of
#Wed Jul 18 11:01:53 PDT 2007?
Please help.
Thanks.