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'.
精彩评论