「java」getClassLoader().getResourceAsStream()の使い方

1.test.properties
city=Tokyo

2.Javaコード
public class CftInfo {
//some code
try {
InputStream is = null;
Properties dd = new Properties();
is = CftInfo.class.getClassLoader().getResourceAsStream(“test.properties");
dd.load(is);
is.close();

String strCity = dd.getProperty(“city");
//略
} catch (Exception e) {
e.printStackTrace();
}

}

Java

Posted by arkgame