I am using the following code to read a properties file:
Properties pro = new Properties();
InputStream is = Thread.currentThread().getContextClassLoader().
I had the same problem and this helped me:
InputStream is;
try {
is = this.getClass().getClassLoader().getResourceAsStream("config.properties");
prop.load(is);
String url = prop.getProperty("url");
String user = prop.getProperty("user");
String pass = prop.getProperty("password");
is.close();
// opening database connection to MySQL server
con = DriverManager.getConnection(url, user, pass);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}