I have to access my .properties file from its class path. Currently I am accessing that from the resources folder directly. But now I want to acess that from the class path.
Current Code:
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
try {
properties.load(new FileInputStream(
"src/resources/config.properties"));
for (String key : properties.stringPropertyNames()) {
String value = properties.getProperty(key);
rate.add(value);
}
}
}
Path of the file is :src/resources/config.properties
For deploying the code we are creating war file of the complete project.
Please suggest how can we get this file from the class path.