Load a properties file in the classpath
import java.io.File; import java.io.FileInputStream; import java.net.URL; import java.util.Properties; public class Main { public static void main(String args[]) throws Exception { Properties props = new Properties(); URL url = ClassLoader.getSystemResource("myprops.props"); props.load(url.openStream()); System.out.println(props); } }