Redian新闻
>
java里面怎么得到一个系统的环境变量?
avatar
java里面怎么得到一个系统的环境变量?# Java - 爪哇娇娃
w*y
1
譬如得到一个环境变量SLIF?
thx
avatar
m*t
2

There is System.getEnv(), but it's deprecated since 1.2 - now in the new 5.0
it's been de-deprecated again. 8-)

【在 w***y 的大作中提到】
: 譬如得到一个环境变量SLIF?
: thx

avatar
c*s
3
不好整。getenv会抛出异常的。
还是启动程序时用 -D去传吧。

【在 w***y 的大作中提到】
: 譬如得到一个环境变量SLIF?
: thx

avatar
xt
4

Oh? That's better. I hate the fact that java cannot read environmental
variables.

【在 m******t 的大作中提到】
:
: There is System.getEnv(), but it's deprecated since 1.2 - now in the new 5.0
: it's been de-deprecated again. 8-)

avatar
m*t
5

5.0
Well, I guess they took it out before because env variables are hardly
platform neutral, then eventually they realized everybody has to write a shell
script to convert the env variables to properties in order to start a java
program, and then shell scripts are kinda hard to be platform neutral
anyway...

【在 xt 的大作中提到】
:
: Oh? That's better. I hate the fact that java cannot read environmental
: variables.

avatar
h*j
6
System.getProperty("SLIF")

【在 w***y 的大作中提到】
: 譬如得到一个环境变量SLIF?
: thx

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。