-
1. Re: property file outside jar
cristalleke May 22, 2006 7:49 AM (in response to cristalleke)Is there no expert who can help me or provide me a link where I can find some information?
-
2. Re: property file outside jar
peterj May 22, 2006 11:00 AM (in response to cristalleke)The following should work, assuming that your placed the properties file in the temp directory:
Properties.load(new FileInputStream("/temp/myprops.properties");
Or, let's say that you wanted to place the properties file into the JBoss server's data directory, then you could do:
String dir = System.getProperties("jboss.server.data.dir");
Properties.load(new FileInputStream(dir + "/myprops.properties");
There are several other system properties that describe other locations within JBoss. -
3. Re: property file outside jar
cristalleke May 23, 2006 11:30 AM (in response to cristalleke)Thanks for the reply.
In fact this is the problem I want to avoid.
In case I put the location hard coded and the location of the property files changes, I have to do a code change.
So I just want to have the property file name in the code (e.g. "appspec.properties") and make sure this property file is retreived.
In this case, what do I have to configure to make sure the property file is searched in the correct location? -
4. Re: property file outside jar
peterj May 23, 2006 1:05 PM (in response to cristalleke)An option that will tell the application where to look for the properties file because you want to hide it in a different location each time you run? How about specifying your own system property which defines the directory where the file is located.
Personally, I would use a combination of my own system property along with the JBoss data directory property. If my system property is set, I would look there, if not then I would look in the data directory, and if not there, in no directory, which equates to the current working directory, which would be the JBoss bin directory. If I planned to run my application in app servers other than JBoss, I would add some of their system properties to my list of places to look.