When to use environment variables vs. system properties?

后端 未结 4 1418
眼角桃花
眼角桃花 2021-02-05 23:56

I wonder which of the following is a preferred approach?

We can set things up as APP_HOME=/path/to/file (export in .profile or som

4条回答
  •  一整个雨季
    2021-02-06 00:42

    One important difference between using Environment Variables (envs) and System properties which should be considered is that the envs could not be changed at runtime/in the running process, BUT System properties could be. Refer to the Javadoc:

    https://docs.oracle.com/javase/8/docs/api/java/lang/System.html#setProperties-java.util.Properties-

提交回复
热议问题