14
내 응용 프로그램에 속성 파일을 추가해야합니다. 이 파일을 controller
디렉토리에 추가했지만로드 할 수 없습니다 (클래스 경로에 no?) - InputStream
이 null입니다. 이 파일을 어디에 둘지 액세스 할 수 있습니까?리소스를 넣을 위치는 어디입니까?
public class Application extends Controller {
static {
try {
Properties p = new Properties();
InputStream in = Application.class.getClassLoader().getResourceAsStream("accounts.properties");
if(in != null) {
p.load(in);
in.close();
} else {
error("null inputstream");
}
} catch (Exception e) {
e.printStackTrace();
}
}
// Actions below
// ...
}
최신 버전의'sbt'에서는 다음과 같이 작성합니다 :'resourceDirectories in Compile + = baseDirectory.value/" myresources " –