Simple problem, I need to write a sitemap to my web root directory so that it is accessible as so:
I want the code to look like:
File f = new File( someMethodToGetWebRootDirectory() );
But I don't know what should be in that method
Simple problem, I need to write a sitemap to my web root directory so that it is accessible as so:
I want the code to look like:
File f = new File( someMethodToGetWebRootDirectory() );
But I don't know what should be in that method
Will something along the lines of:
File classesDir = new File(YourServlet.class.getProtectionDomain()
.getCodeSource().getLocation().getPath().replaceAll('/', File.separator));
File rootDir = classesDir.getParentFile().getParentFile();
work?