As suggested by this answer:
You can call
System.setProperty("line.separator", "\r\n");
in order to set the system property inside your code.
it is quite easy to make a Java program output the desired line endings. However, I see no reason why one shouldn't be able to change that environment variable, say, as a compiler setting?