私は.propertiesファイルのファイルを読み込むと、次のようなコードを持っていることを試みた:プロパティファイルはどこに置くのですか?
public final class Config {
static {
Properties properties = new Properties();
InputStream propertiesStream = Object.class.getResourceAsStream("config.properties");
if (propertiesStream != null) {
try {
properties.load(propertiesStream);
} catch (IOException e) {
e.printStackTrace();
}
} else {
System.out.println("file not found");
}
}
}
が、それは、ファイルが見つからないと言っ保持します。
プロパティの内容は
pwd=passw0rd
誰もがこの問題を解決する方法を知っているのですか?
使用しているフレームワークが春であれば、これは正常に動作します –