I am using eclipse and Tomcat to develope a simple Web tool. I have a question on the "new java.io.File( "." ).getCanonicalPath()" in my servlet/jsp. When I run the web project in my eclipse, I found the new java.io.File( "." ).getCanonicalPath() is D:\eclipse, But after I export the web project and put it into my CATALINA_HOME\webapp, the java.io.File( "." ).getCanonicalPath() is changed to CATALINA_HOME\bin
Here is what I am doing. In my servlet, I create a thread to carry a long time job. The thread is trying to read/write a batch of files, (these files includes some input files, some xml etc), do some db operations and put the result data into some files. These files have to be put at the current directory.
I found this current directory is the CATALINA_HOME\bin after I deployed my project in the CATALINA_HOME\webapp. I hope I could have a central place to put this batch of files and my result.
Could anybody give me a help and tell me how I can customize this dirrectory?
Bear Bibeault wrote:There is no concept of a "current directory" in web applications.
I'd supply the location of a temp folder, outside of the web app, via a property or context param.
I call it current directory because of the "new java.io.File( "." ).getCanonicalPath()", sorry if the name is not good. Could you please suggest me where/how to configure it? For the context param, do you mean the parameters of Tomcat? I tried to make some configuration changes for tomcat, but I did not find anything good. Could you please tell me a little more?