I've got a simple Java program I wrote, that does some basic text output, using System.out.printf(). In my strings, I use \n to terminate the lines. I'm pretty sure that in the past, when I ran my Java program, the output had correct line termination on Windows.
But, today I re-ran my program, and the printf statements are not properly terminating the lines (e.g. outputting \r\n on Windows).
Is there some sort of JVM setting which controls this? What is the 'proper' way to terminate lines within strings, so that regardless of what platform you run the program on, Java will emit the correct line terminator? I had been under the impression that Java was supposed to translate the \n automatically into the correct line terminator - is that not correct?
But, today I re-ran my program, and the printf statements are not properly terminating the lines (e.g. outputting \r\n on Windows).
Is there some sort of JVM setting which controls this? What is the 'proper' way to terminate lines within strings, so that regardless of what platform you run the program on, Java will emit the correct line terminator? I had been under the impression that Java was supposed to translate the \n automatically into the correct line terminator - is that not correct?