今天为了通过java读取properties文件,google了很长时间,终于找到了.现在特记录之和大家一起分享. 下面直接贴出代码:java类 public class Mytest public static void readFile(String fileName) {//传入参数fileName是要读取的资源文件的文件名如(file.properties) InputStream in = null; Properties pros = new Properties(); tr
使用J2SE API读取Properties文件的六种方法 1.使用java.util.Properties类的load()方法示例: InputStream in = lnew BufferedInputStream(new FileInputStream(name));Properties p = new Properties();p.load(in); 2.使用java.util.ResourceBundle类的getBundle()方法示例: ResourceBundle rb = Re