I wonder if you could create a custom ClassLoader that calls a listener any time it succeeds ...
That gives you all you need to map names to URLs.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Joined: Apr 27, 2006
i dont understand how can i implement it so it will give me the path of the prop file the RB found
Joined: Jan 29, 2003
I left a lot out of that suggestion.
First, read up on ClassLoaders. You can write a custom ClassLoader that extends URLClassLoader and override the method I showed before. When it succesfully loads a class, it calls a listener object with name and full classname. You might pass that listener object to your ClassLoader in the ClassLoader constructor.
Then pass your own ClassLoader to ResourceBundle.get().
Now ResourceBundle calls the ClassLoader over and over, once for each candidate name that it might load. When it actually finds a file, the loader will call your listener and you save off the information. When ResourceBundle returns you a bundle, the info you saved should be the latest file loaded.
I can't guarantee this will work out ... give it a try and see!
subject: how can i get the path from which resource bundle gets its bundle file