Here you can find the source of loadPropertiesFromClasspath(String pfname)
public static Properties loadPropertiesFromClasspath(String pfname)
//package com.java2s; /*// w w w.j a va2 s. co m * Copyright (c) 2010, Joshua M. Clulow. All rights reserved. * * This software is distributable under the BSD license. See the terms of the * BSD license in the documentation provided with this software. */ import java.io.InputStream; import java.util.Properties; public class Main { public static Properties loadPropertiesFromClasspath(String pfname) { Properties p = new Properties(); // ClassLoader cl = ClassLoader.getSystemClassLoader(); ClassLoader cl = Thread.currentThread().getContextClassLoader(); InputStream is = cl.getResourceAsStream(pfname); if (is == null) throw new RuntimeException("Could not find " + pfname + " in CLASSPATH"); try { p.load(is); } catch (Exception e) { throw new RuntimeException("Could not load " + pfname + ": " + e.getMessage()); } return p; } }