質問

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