3
In einem Programm, ich arbeite auf IInput null ist
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();
}
Aus irgendeinem Grund haben, obwohl, c.load(in);
verursacht eine NullPointerException
. Die Ausnahme kommt von , die wahr ist. Ich kann nicht herausfinden, warum, weil
System.out.println(cwd + file_separator + "data" + file_separator +
"configuration.properties");
/users/labnet/st10/jjb127/workspace/Brewer-Client/data/configuration.properties
, die die Position der Datei, die ich verwenden bin zu wollen.
Gedanken?