今天为了通过java读取properties文件,google了很长时间,终于找到了.现在特记录之和大家一起分享. 下面直接贴出代码:java类 public class Mytest public static void readFile(String fileName) {//传入参数fileName是要读取的资源文件的文件名如(file.properties) InputStream in = null; Properties pros = new Properties(); tr…
import java.io.IOException; import java.io.InputStream; import java.util.Properties; public class GetProperties { public static void main(String[] args) throws IOException { Properties p = new Properties(); InputStream in = GetProperties.class .getRe…