Not able to load properties file kept outside the code
<pre><code>import static com.qcom.ems.search.crawler.constants.CrawlerConstants.CONFIG_DIR;
import static com.qcom.ems.search.crawler.constants.CrawlerConstants.CRAWLER4J_PROP;


import java.util.Properties;


public final class Configurations {

    private static Properties prop = new Properties();


    public static String getStringProperty(String key, String defaultValue) {
        if (prop == null || prop.getProperty(key) == null) {
            return defaultValue;
        }
        return prop.getProperty(key);
    }

    public static int getIntProperty(String key, int defaultValue) {
        if (prop == null || prop.getProperty(key) == null) {
            return defaultValue;
        }
        return Integer.parseInt(prop.getProperty(key));
    }

    public static short getShortProperty(String key, short defaultValue) {
        if (prop == null || prop.getProperty(key) == null) {
            return defaultValue;
        }
        return Short.parseShort(prop.getProperty(key));
    }

    public static long getLongProperty(String key, long defaultValue) {
        if (prop == null || prop.getProperty(key) == null) {
            return defaultValue;
        }
        return Long.parseLong(prop.getProperty(key));
    }

    public static boolean getBooleanProperty(String key, boolean defaultValue) {
        if (prop == null || prop.getProperty(key) == null) {
            return defaultValue;
        }
        return prop.getProperty(key).toLowerCase().trim().equals("true");
    }

    static {
        try {
            prop.load(Configurations.class.getClassLoader()
                    .getResourceAsStream(CONFIG_DIR + "/" + CRAWLER4J_PROP));
        } catch (Exception e) {
            prop = null;
            System.err.println("WARNING: Could not find crawler4j.properties file in class path. I will use the default values.");
        }
    }
}
</code></pre>

<p>In my try loop above it is not loading crawler4j.properties file. As previously it was like this-</p>

<pre><code>try {
                prop.load(Configurations.class.getClassLoader()
                        .getResourceAsStream("crawler4j.properties"));
            }
</code></pre>

<p>so it was able to load it directly from the src/main/resources folder. But I want to load this crawler4j.properties file kept outside the code in different directory. So I have stored crawler4j.properties file in /my/dir/conf/crawler4j.properties  and this is try loop that I want to modify-</p>

<pre><code>try {
                prop.load(Configurations.class.getClassLoader()
                        .getResourceAsStream(CONFIG_DIR + "/" + CRAWLER4J_PROP));
            }
</code></pre>

<p>And CONFIG_DIR contains \my\dir\conf and CRAWLER4J_PROP has crawler4j.properties but somehow it is not loading and it is going to catch exception block. Any suggestions why is it happening.</p>
