Loading properties file in static object

hey guys,

im trying to load a properties file in the memory by loading it in a object. So i created a static object (singleton called Trans) with two methods :

  1. Trans.init : loads the file in a Properties object
  2. Trans.getInstance : gets a reference to the object.

Problem is that i would like to read the file in in one package (init method) and get a reference in another package(getInstance) so i can access to the file loaded in the static object…

But that doesn’t seem to work… Does anybody know why not?

Is there another way to easily load a file into memory, so that is accessible in all packages??

Greetz,

Wout

Don’t call your getInstance method directly. Instead, create a service in the package that contains your singleton object which returns the data you want. You might as well have that service convert the data to a IS document format, although I suppose you could return the Java object directly. Your other package can then call this service to get the data you need.