I'm appending data to a text file using java in unix openjdk version 1.8.0_151 using the Files.write() method.
I read this question which advised me to use System.lineSeparator() instead of "\n".
My code looks like this:
try {
    Files.write(Paths.get("spillInfo.txt"), 
    (infoString + System.lineSeparator()).getBytes(), 
     StandardOpenOption.APPEND);
} catch (IOException e) {
     System.err.println("Caught IOException: " +  e.getMessage());
}
From this question Notepad uses the ANSI charset and from this question that charset in java is "cp1252" but when I add "cp1252" or "windows-1252" as the arugment of getBytes() (or if I leave it empty like in the code above) the new lines do not show up in notepad (they do show up in notepad++ on all three counts).
 
    