java load properties

Properties prop = new Properties();
 InputStream in = this.getClass().getClassLoader().getResourceAsStream("db.properties");//文件在src下
 prop.load(in);
 mysqldriver = prop.getProperty("mysqldriver").trim();
 connection = prop.getProperty("connection").trim();
 username = prop.getProperty("username").trim();
 password = prop.getProperty("password").trim();
 Class.forName(mysqldriver);
 conn = DriverManager.getConnection(connection, username, password); 
this.getClass().getClassLoader().getResource("com/ectrip/selfserviceticketing/resource/ectrip.png")



InputStream in = this.getClass().getClassLoader().getResourceAsStream("db.properties");




你可能感兴趣的:(java,properties,properties,properties,load,load)