Java系统属性和环境变量 [英] Java system properties and environment variables

查看:210
本文介绍了Java系统属性和环境变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

系统属性之间有什么区别 System.getProperties()和环境变量 System.getenv()

What's the difference between system properties System.getProperties() and environment variables System.getenv() in a JVM?

推荐答案

我认为区别两个归结为访问。系统环境变量可由任何进程访问,Java系统属性只能通过添加它们的进程访问。

I think the difference between the two boils down to access. System environment variables are accessible by any process and Java system properties are only accessible by the process they are added to.

同样如波希米亚所述,在操作系统中设置了env变量(但它们可以通过Java设置),系统属性作为命令行选项传递或通过 setProperty()

Also as Bohemian stated, env variables are set in the OS (however they 'can' be set through Java) and system properties are passed as command line options or set via setProperty().

这篇关于Java系统属性和环境变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆