加載當前類路徑下的 properties 文件
Properties properties = new Properties(); // 使用ClassLoader加載properties配置文件生成對應的輸入流 InputStream in = 當前類名.class.getClassLoader().getResourceAsStream("emailConfig.properties"); // 使用properties對象加載輸入流 properties.load(in); //獲取key對應的value值 account=properties.getProperty("account"); password=properties.getProperty("password");