在Java中设置环境变量。 [英] Set an environment Variable in Java.

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

问题描述

有一个获取环境变量的API,System.getEnv。

但是没有setEnv方法?

有没有问题要实现?

请解释???


Debasis Jana。

解决方案


有一个获取环境变量的API,System.getEnv。

但是没有setEnv方法?

有没有有什么问题要实现吗?

请解释???


Debasis Jana。



你不需要它;如果你想要一个可变的环境,你可以建立自己的环境:

展开 | 选择 | Wrap | 行号



你不需要它;如果你想要一个可变的环境,你可以建立自己的环境:

展开 | 选择 | Wrap | 行号



感谢您的回复....!

但我怎么能让它持久?

我应该使用序列化吗?


还有一件事..为什么SUN没能设计System.setEnv?

我需要这个解释..请...


Debasis Jana



Sun在设计这种方法时并没有失败,因为正如我之前所写,你是不需要它; b $ b需要它;看看 Runtime.exec(...)方法:你可以把它传递给你自己的环境,所以你不必把它传给你自己的环境。它不需要改变你自己的环境。


亲切的问候,


Jos


There is an API to get the environment variable, "System.getEnv".
But there is no setEnv method ?
Was there any problem to implement that?
Please explain ???

Debasis Jana.

解决方案

There is an API to get the environment variable, "System.getEnv".
But there is no setEnv method ?
Was there any problem to implement that?
Please explain ???

Debasis Jana.

You don''t need it; if you want a changeable environment you can build your own:

Expand|Select|Wrap|Line Numbers


You don''t need it; if you want a changeable environment you can build your own:

Expand|Select|Wrap|Line Numbers


Thanks for your reply ....!
But how could I make it persistent ???
Should I use Serialization?

Anyway one more thing ..why SUN failed to design System.setEnv?
I need this explain ..please!

Debasis Jana

Sun didn''t fail in designing that method because, as I wrote before, you don''t
need it; have a look at the Runtime.exec( ... ) methods: you can pass it
an environment yourself so you don''t have to pass it your own environment. It
simply isn''t needed to alter your own environment.

kind regards,

Jos


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

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