//讀取配置文件 public class Tools { public static Properties loadProperties() { Properties properties = new Properties(); try { properties.load(ClassLoader.getSystemResourceAsStream("database.properties")); } catch (IOException e) { System.err.println("讀取配置文件失敗"); } return properties; } }