I have created a text file in Unix environment using Java code.
For writing the text file I am using java.io.FileWriter
and BufferedWriter
. And for newline after each row I am using bw.newLine()
method (where bw
is object of BufferedWriter
).
And I'm sending that text file by attaching in mail from Unix environment itself (automated that using Unix commands).
My issue is, after I download the text file from mail in a Windows system, if I
opened that text file the data is not properly aligned. newline()
character is
not working, I think so.
I want same text file alignment as it is in Unix environment, if I opened the text file in Windows environment also.
How do I resolve the problem?
Java code below for your reference (running in Unix environment):
File f = new File(strFileGenLoc);
BufferedWriter bw = new BufferedWriter(new FileWriter(f, false));
rs = stmt.executeQuery("select * from jpdata");
while ( rs.next() ) {
bw.write(rs.getString(1)==null? "":rs.getString(1));
bw.newLine();
}