I would like to read MANIFEST.MF
of my WAR
application. How can I find its file name?
How can I find its file name?
You already have it. Maybe you meant to find the absolute file location? You can use ServletContext#getRealPath() for this.
String relativeWARPath = "/META-INF/MANIFEST.MF";
String absoluteDiskPath = getServletContext().getRealPath(relativeWARPath);
File file = new File(absoluteDiskPath);
// ...
Or if you want to get it as InputStream
directly, use ServletContext#getResourceAsStream().
InputStream input = getServletContext().getResourceAsStream("/META-INF/MANIFEST.MF");
// ...