String propFile = "propConfig.properties";
URL url = Thread.currentThread().getContextClassLoader().getResource(propFile);
Properties prop = new Properties();
prop.load( url.openStream() );
or
Properties prop = new Properties();
try
{
prop.load(Thread.currentThread().getContextClassLoader().getResourceAsStream("hello.properties"));
}
catch (FileNotFoundException e)
{
e.printStackTrace();
}
catch (IOException e)
{
e.printStackTrace();
}
0 ความคิดเห็น:
แสดงความคิดเห็น