getResource to file code example
Example 1: java resource file
File file = new File(
getClass().getClassLoader().getResource("database.properties").getFile()
);
Example 2: java resource file
InputStream inputStream = getClass()
.getClassLoader().getResourceAsStream("database.properties");