Here you can find the source of load(String propertiesName)
Parameter | Description |
---|---|
propertiesName | name of the properties file. The file needs to be on the classpath. |
Parameter | Description |
---|---|
IOException | IOException |
public static Properties load(String propertiesName) throws IOException
//package com.java2s; import java.io.*; import java.net.URL; import java.util.Properties; public class Main { /**/*w ww. ja v a2 s .c o m*/ * Utility to load a properties file from the classpath. * @param propertiesName name of the properties file. The file needs to be on the classpath. * @return Properties * @throws IOException IOException */ public static Properties load(String propertiesName) throws IOException { Properties p = new Properties(); URL url = ClassLoader.getSystemResource(propertiesName); if (url == null) { throw new FileNotFoundException("Properties file not on classpath: " + propertiesName); } InputStream is = url.openStream(); try { p.load(is); } finally { is.close(); } return p; } }