Forums Register Login

message resource bundle

+Pie Number of slices to send: Send
we are using message resource bundle and it is called by ResourceBundle bundle = bundleManager.getBundle(basename, context.getViewRoot().getLocale(),Util.getCurrentLoader(this));

The properties files are located outside the jar and to get them loaded, we put the path to them in the classpath property of the Websphere server.

Everything is fine and working, however we no longer are able to put the path to the properties file in the classpath property fo the webspher server.

Is there a way I can pass the location to the loader in my java code?
+Pie Number of slices to send: Send
You would need to create a URLClassLoader and pass the path to it.

Altenatively, move the properties files to the applications current classpath. What I have done in the past for production was to package the properties files in a JAR and put a resource manager class inside the same JAR. That way I could easily move the bundle around as needed and use the resource manager's class loader to find the properties. Of course this is good for read-only purposes. In your development system, or when you need the properties to be manipulated, you keep the properties and the resource manager in the same package structure inside your normal classpath.
get schwifty. tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1386 times.
Similar Threads
Java property files best practices
how to set different dir to resource bundle file
Properties file path hard coded
Can I access messages.properties from a groovy class?
.properties vs JNDI
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 13:30:46.