开发者

Java: Modifying System Properties for a Java App

I am using a Java JMS GUI utility (HermesJMS), and in its runtime, I need to invoke:

System.setProperty("user.name", "s24park");

Is there a properties file开发者_开发问答 within JDK(1.6.0.18) that stores system properties?


You can use -D flag when launching your application.

java -Duser.name=s24park YourClass

See this post for more information. There is no file for System properties.


An interesting link I had come upon recently:

http://leepoint.net/notes-java/io/30properties_and_preferences/40sysprops/10sysprop.html

You can also use the Properties class - but this has nothing to do with "system" properties. Any properties can be saved and loaded via this class


It is possible that your JVM may have one or more configuration files in which it is possible to create permanent system properties. That said, you really should be using java.util.prefs.Preferences.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜