`

java读取properties配置文件

    博客分类:
  • java
 
阅读更多
try {
			File directory = new File(".");
			String proPath = directory.getCanonicalPath();
			System.out.println(proPath+"\\resources\\smsContent.properties");
			InputStream in = new BufferedInputStream(new FileInputStream(proPath+"\\resources\\smsContent.properties"));
			Properties p = new Properties(); 
			p.load(in);
			System.out.println(p.getProperty("smsContent"));
			in.close();
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics