package javacodebook.core.extprops; import java.util.Properties; import java.io.InputStream; public class Starter { public static void main(String[] args) throws Exception { // Eigenen Properties, welche zu den System-Properties hinzugefügt // werden sollen. Properties props = new Properties(); props.put("appl.width", "100"); props.put("appl.height", "80"); props.put("appl.color", "blue"); props.put("user.name", "Hänschen"); // Jetzt der Trick: Es werden neue Properties erzeugt. Als Default-Props // werden die eigenen Properties angegeben. Anschliessend werden die neuen // Properties mit allen System-Properties gefüllt. Properties newSystem = new Properties(props); newSystem.putAll(System.getProperties()); // Die neuen Properties (System-Properties und eigene Properties) werden // als die neuen System-Properties angemeldet. System.setProperties(newSystem); // Alle Properties auflisten System.getProperties().list(System.out); } } --- Neue Klasse --- package javacodebook.core.extprops; 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; } }