配置檔案:system.properties
內容格式,比如:shiyishi=haode
java程式碼如下
import java.util.Properties; public class SystemParameter { private static Properties pro; public static String CHANGLIANGE; static{ try { pro=new java.util.Properties(); pro.load(new SystemParameter().getClass().getClassLoader().getResourceAsStream("system.properties"));
CHANGLIANGE = pro.getProperty("shiyishi"); } catch (Exception e) { e.printStackTrace(); } } }