Showing posts with label Classloader. Show all posts
Showing posts with label Classloader. Show all posts

Saturday, November 3, 2012

Load Properties File with ClassLoader

For those who want to load a Properties file located in the classpath (could be the classpath of your server: Far from your artifact), this is how a Properties Files is loaded "like a Sir!"


Simple! Instead of using the traditional way
getClass().getResourceAsStream(propertiesFile);

By doing it in that way, we make sure the ClassLoader will look further into the classpath other than just look in the near surroundings :P