문제

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?

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top