Answer the question
In order to leave comments, you need to log in
Where should the file for getClassLoader().getResourceAsStream be located?
Hello.
There was a need to transfer information about database connections to a separate file. I tried to use this option, BUT I still can’t figure out where the db.properties file should be physically located
Properties prop = new Properties();
InputStream inputStream = FetchData.class.getClassLoader().getResourceAsStream("/db.properties");
prop.load(inputStream);
String driver = prop.getProperty("driver");
String url = prop.getProperty("url");
String user = prop.getProperty("user");
String password = prop.getProperty("password");
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question