default properties file

A loooong time ago I remember playing with a file that went in your cwd or somewhere on the classpath that was loaded, by default, and the properties in it were stuffed into the system properties. I’m not sure if the method for loading some ‘default’ properties exists any more (I certainly don’t use it), but I am sure it at least used to, and its one of those things thats is going to drive me mad if I don’t find out :). So, does anyone have any ideas what the file was called, java.properties, or system.properties i thought. Any ideas?

Endolf

Don’t you just use the java.util.properties package, and then programmatically store / retrieve / delete whatever you want?

Or am I missing the point entirely?

Thats what I do now, yes, but i’m sure there was a file that was automatically loaded into system properties if it existed.

Endolf

Whenever I’ve used Preferences, all the get* methods need a default arg which is used if the actual value isn’t found, which is how I handle defaults (plus a big class which defines all the defaults).

You could write a load of defaults, then export it as xml. Then distribute the xml and load it into preferences first time you run your app. Could cause problems if people go manually tinkering in the registry though.

Ok, I think i mis stated this. I know how to load a properties files, I know about including defaults in the get methods, this is a specific query as to something that is bugging me. I’m sure I have used in the past a file, dumped in cwd or somewhere in the classpath, that no matter what code I ran, and with no adjustments to it, would automatically get loaded. Usefull for sticking in system properties for debugging/logging information that you don’t have the code for, when you can be bothered to type -D on the command line in a startup script of some sort.

It’s not about solving a problem, it’s about remembering something I used to do. It’s bugging me that I can’t remember, even though i’m not going to use it. Like trying to remeber how to write text to the screen in pascal, i’m never going to need to use it again, but the other day it was bugging me as to how I used to do it.

Hope thats clearer, although english is my first language, i’m still crap at it :slight_smile:

Endolf

Had to quote it, :slight_smile:

The file you’re thinking of is “java.properties”, we used it at Lucent for that LDAP thing, I don’t think the java world still supports it, as I rememeber it was something to do with the ORB we were using at the time… Visibroker? used to pull all the properties out and stick them in system properties. Or was it to do with the signing process…

Damn, now you’ve got me started…

Kev