Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Where java.properties file is kept

 
Pete Lyons
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can't believe that I can't find this on google nor java.sun.com,
but isn't there a java properties file stored somewhere in the jre installation that I can edit to permanently set a system property to a non-default value? I tried $JAVA_HOME/jre/lib/java.properties, but that did not seem to work.
 
Marilyn de Queiroz
Sheriff
Posts: 9059
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
found in System class:
"private static native Properties initProperties(Properties props);"

It would seem that the System Properties are initialized by a native method. Unless you can access/change that method, I would say that your chances of permanently changing a System Property are pretty slim.
 
Pete Lyons
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't intend to alter system properties like os.name, etc. You know how you can specify you java.policy file to setup your security policy? I thought you could do the same with a properties file so that instead of always doing:
java -DMyCustomSysProperty=myValue
I could just set it once in a file and forget it. Maybe I'm just imagining the whole thing.
 
Dave Landers
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Make your program do it.
Either keep your own singleton properties object (probably best), or add them to System properties. Something like:
 
Dave Landers
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wait - I just reread your post. What I suggested works if you want to set custom properties, but it will not work for things like security policy that are established as the vm is bootstraped. Sorry for the misdirection.
 
Pete Lyons
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the tips. I'll interpret these suggestions to mean "no". Oh well, I could have sworn there was something just like font.properties, but I guess not.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic