package com.papapa.test;
import java.io.IOException;
import java.util.Properties;
import java.io.InputStream;
/**
* time 2015-6-19
* @author 喔哈哈
* java读取properties配置文件
*/
public class test_0619 {
public static class ProTools {
public String getPath(String key,String path){
ProTools proTools = new ProTools();
InputStream in = proTools.getClass().getResourceAsStream(path);
Properties prop = new Properties();
try {
prop.load(in);
} catch (IOException e) {
e.printStackTrace();
}
return prop.getProperty(key) ;
}
public static void main(String[] args) {
ProTools pro = new ProTools() ;
System.out.println(pro.getPath("url","/test.properties"));
}
}
}