Is there no expert who can help me or provide me a link where I can find some information?
The following should work, assuming that your placed the properties file in the temp directory:
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.
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?
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.