Reputation: 5375
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?
Upvotes: 0
Views: 568
Reputation: 359786
Because that's simply not how environment variables work, by definition. Environment variables are dictated by the runtime environment, not by the compiler or any compile-time setting.
Many operating systems use environment variables to pass configuration information to applications. Like properties in the Java platform, environment variables are key/value pairs, where both the key and the value are strings. The conventions for setting and using environment variables vary between operating systems, and also between command line interpreters.
Upvotes: 5