Creating a folder in web application directory?
843841Nov 20 2004 — edited Feb 2 2005Hi
I have a web application which contains some jsps and servlets and i am running it on Apache Tomcat 4.1. The name of my application is MyApp which contains all the servlets and jsps.
In order to deploy the application i have placed the MyApp folder in the 'webapps' folder of Tomcat. Now in one of my servlets i.e. 'DirectoryCreator', i am trying to create a folder i.e. 'Directory' in the MyApp folder. The problem is that i dont want to give an absolute path to the File class constructor. The class files of my servlets are in classes folder i.e. MyApp \ Web-INF \ classes.
I have tried:
File f = new File("/Directory");
f.mkdir();
but this creates the Directory folder in my C drive.
Please tell me how i can avoid giving the absolute path.
Thanks.