开发者

How to set system properties through a file with Oracle's JVM

开发者 https://www.devze.com 2023-04-04 08:57 出处:网络
According to Oracle, the only way to set system properties is through command line -D parameters like that :

According to Oracle, the only way to set system properties is through command line -D parameters like that :

java -Dmy.prop=value com.package.MyClass

Is it really the only way ? Isn't it possible to create some system.properties file that will contain all these properties, and that would be automagically read when the JVM starts ?

I precise I can have no use of the System.setProperty(String,String) function.[1]

Setting this file through a command line parameter would be fine as well :

java -Fsystem.properties com.package.MyClass

I have searched where I know (and found there is a way with IBM's JVM), but I'm still empty-handed...

[1] : The goal is to set the default Charset, and this is primarily done through the file.encoding property, but only at the VM 开发者_StackOverflow社区startup phase. Setting this property in runtime doesn't change the default Charset, and there is also no way to change it 'programmatically'.

0

精彩评论

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

关注公众号