Here you can find the source of loadSystemPropertiesFromPropertiesResource(String propertiesResourceName)
public static void loadSystemPropertiesFromPropertiesResource(String propertiesResourceName)
//package com.java2s; /*L//from w w w. j a v a2 s .c o m * Copyright SAIC, Ellumen and RSNA (CTP) * * * Distributed under the OSI-approved BSD 3-Clause License. * See http://ncip.github.com/national-biomedical-image-archive/LICENSE.txt for details. */ import java.util.Properties; import java.net.URL; public class Main { /** * Load the specified properties file from the classpath, and add every property * as a system property. This is typically used to assist testing. * * <P>If resrouce is not to be found, a RuntimeException will be thrown. */ public static void loadSystemPropertiesFromPropertiesResource(String propertiesResourceName) { try { Properties props = new Properties(); URL url = ClassLoader.getSystemResource(propertiesResourceName); props.load(url.openStream()); for (Object key : props.keySet()) { System.setProperty((String) key, (String) props.get(key)); } } catch (Throwable e) { e.printStackTrace(); throw new RuntimeException(e); } } }