package com.qxm.soap;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.Properties;
public class ReadProperties {
/**
* @param args
*/
public static void main(String[] args) throws Exception{
ReadProperties rp = new ReadProperties();
rp.getPropertiesFile();
}
public void getPropertiesFile() throws Exception{
Properties pro = new Properties();
//InputStream is = this.getClass().getClassLoader().getResourceAsStream("d:\\a.properties");
InputStream is = new FileInputStream(new File("d:\\a.properties"));
pro.load(is);
System.out.println("a: "+pro.getProperty("export.types"));
System.out.println("ok");
}
}
java读取properties文件
最新推荐文章于 2024-05-06 20:37:09 发布
本文展示了一个使用Java从本地文件系统中加载属性文件并读取特定属性值的示例。通过创建一个名为ReadProperties的类,我们演示了如何利用Java的Properties类和FileInputStream来实现这一功能。
523

被折叠的 条评论
为什么被折叠?



