package javacodebook.core.properties; import java.io.*; public class ResourceManager { public static InputStream getResourceAsStream(Object object, String resourceName) { ClassLoader cLoader = object.getClass().getClassLoader(); InputStream in = null; if(cLoader != null) { in = cLoader.getResourceAsStream(resourceName); } else { in = ClassLoader.getSystemResourceAsStream(resourceName); } return in; } } --- Neue Klasse --- package javacodebook.core.properties; import java.util.Properties; import java.io.InputStream; public class Starter { public static void main(String[] args) throws Exception { // Die zu ladende Properties-Datei String propsFile = "javacodebook/core/properties/demo.properties"; Properties prop = new Properties(); // Properties aus der Datei lesen InputStream stream = ResourceManager.getResourceAsStream(prop, propsFile); prop.load(stream); // Ein paar Properties anzeigen System.out.println("width=" + prop.getProperty("width")); System.out.println("height=" + prop.getProperty("height")); System.out.println("color=" + prop.getProperty("color")); } }