私が取り組んでいるプログラムでは、
String cwd;
String file_separator;
public ConfigLoader()
{
cwd = get_cwd();
file_separator = get_file_separator();
try
{
Properties c = new Properties();
InputStream in = this.getClass().getClassLoader().getResourceAsStream(cwd +
file_separator + "data" + file_separator + "configuration.properties");
c.load(in);
}
except (Exception e) { e.printStackTrace(); }
}
public String get_file_separator()
{
File f = new File("");
return f.separator;
}
public String get_cwd()
{
File cwd = new File("");
return cwd.getAbsolutePath();
}
ただし、何らかの理由で。c.load(in);
が発生しNullPointerException
ます。例外は真実であることに由来しin == NULL
ます。理由がわからない
System.out.println(cwd + file_separator + "data" + file_separator +
"configuration.properties");
プリント
/users/labnet/st10/jjb127/workspace/Brewer-Client/data/configuration.properties
これは、使用したいファイルの場所です。
考え?