In many situations you may need to use platform-dependent newline character in Java. There are several ways you can get that value, depending on the Java version you are using. System properties Java system properties always includes line.separator property which contains platform-dependent line separator (\n on UNIX and \r …