public class properity2 {
public static void main(String[] args) throws FileNotFoundException, IOException {
//创建对象
Properties pro=new Properties();
//存储
pro.setProperty("driver", "orcle,driver");
pro.setProperty("url", "jdb:orcle,driver");
pro.setProperty("user", "score");
pro.setProperty("pwd", "tiger");
//存储到e:/others绝对路径
pro.store(new FileOutputStream(new File("e:/others/db.properities")),"db配置");
pro.storeToXML(new FileOutputStream(new File("e:/others/db.xml")), "db配置");
//使用相对路径,默认的相对路径是当前的工程
//pro.store(new FileOutputStream(new File("db.xml")),"db配置");
pro.store(new FileOutputStream(new File("src/db.xml")),"db配置");
pro.store(new FileOutputStream(new File("src/que/db.xml")),"db配置");
}
}
[Properties]——配置文件存储
最新推荐文章于 2022-05-30 23:38:50 发布