I have several systems that all need to load the same properties to the JVM. I can use the -D flag to load one property at a time, but i am looking for something that will load
I don't think you can do that via the command line (without some bash hacks, perhaps), but you definitely can do that programatically:
Simply set one property -DmyPropertiesFile=/your/properties/file.properties
and then read that with one of the Properties.load()
overloads. After that, System.setProperties(yourProps)
should do what you expect.
Of course, this requires that you can hook this code early enough so that your properties will be available when needed (For instance, if the main()
method is yours, this is perfect).