Even under Windows it's a bad idea to use backslashes in filename paths in Java. Use forward slashes and you'll be OS-independent. More importantly, you won't make mistakes like the one you made, which was failure to escape the filename's backslash character.
Since in Java, backslash is an escape character, you have to escape it: "reports\\templates". But "reports/templates" is much tidier. And safer.
Incidentally, if you want to read that file, you can save some work by using the "getResourceAsStream" method instead of getting the file and then opening a stream resource on the file to read it.
But NEVER write to anything inside a WAR! If you have to write a file, put it somewhere outside the WAR in the regular filesystem!
An IDE is no substitute for an Intelligent Developer.
rajesh babu Y
posted 7 years ago
Thanks you, my intention is, my folder structure is like this in war file.
i hard coded xml file name. but from ear application context root is /lmt.
give way how i can get the xml file which was located in war WEB-INF/reports/templates/xml from my application context root.