considering the following function
private static void GetText(String nodeValue) throws IOException {
if(!file3.exists()) {
file3.createNewFile();
Solution:
in WINDOWS you should write "\r\n"
for a new line.
the other answers should work. however I wanna mention
from java doc:
FileWriter is meant for writing streams of characters. For writing streams of raw bytes, consider using a FileOutputStream.
reading your method codes, you are about to write String to the file, what you were doing is convert String to raw bytes, then write so I think using FileWriter is not a bad idea.
And for the newline problem, Writer has method .write(String), which is convenient to use.
just use \r\n for endline if you are using windows operating system.