*
The moose likes Beginning Java and the fly likes Where java.properties file is kept Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Where java.properties file is kept" Watch "Where java.properties file is kept" New topic
Author

Where java.properties file is kept

Pete Lyons
Ranch Hand

Joined: Aug 18, 2002
Posts: 109
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

Joined: Jul 22, 2000
Posts: 9047
    
  10
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.


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Pete Lyons
Ranch Hand

Joined: Aug 18, 2002
Posts: 109
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

Joined: Jul 24, 2002
Posts: 401
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

Joined: Jul 24, 2002
Posts: 401
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

Joined: Aug 18, 2002
Posts: 109
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Where java.properties file is kept