Here you can find the source of loadProperties(String propertyName)
Parameter | Description |
---|---|
propertyName | a parameter |
Parameter | Description |
---|---|
Exception | an exception |
public static Properties loadProperties(String propertyName) throws Exception
//package com.java2s; //License from project: Open Source License import java.io.File; import java.io.FileInputStream; import java.util.Properties; public class Main { /**//from w w w . ja va 2s.co m * Loads a properties file in the startup directory * * @param propertyName * @return * @throws Exception */ public static Properties loadProperties(String propertyName) throws Exception { Properties props = new Properties(); File file = new File(propertyName); FileInputStream fis = null; if (file.exists()) { fis = new FileInputStream(file); props.load(fis); } else { props = null; } return props; } }