プロパティ ファイルを読み込もうとしています。ロードしようとしているクラスと同じディレクトリに
プロパティファイルがあります。
例:
package com.classes.internal;
public class ClassA {
private static String PFILE = "config.properties";
private static void methodA(){
//do stuff
Properties properties = null;
try{
properties = new Properties();
properties.load(new FileInputStream(PFILE));
//properties.load(new ClassA().getClass().getResourceAsStream(PFILE)); --> Does not work either
}catch(Exception e){
e.printStackTrace();
}
}
またconfig.properties
、ファイルは com\classes\internal dir にあります
しかし、FileNotFoundException
またはを取得しますjava.lang.NullPointerException
(最初の行ではなくコメントアウトされた行を使用する場合)
ここで何が間違っていますか?私は何を誤解していますか?