This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
I'm uploading some files to Tomcat via a webapp. I was surprised to find the default location was to store uploaded files in the bin directory. Is there a uploaded file location specified for all J2EE-compliant JPS/Servlet containers, and how do I get it?
If you are saving files in a way that depends on the "current" directory, there is no way of telling where they will end up. You must use code that controls the complete file path. Bill
Joined: Feb 13, 2003
If I do that, the system won't be portable to another app server, or another computer. At the very least this system will at some point be on a production server, rather than a dev one.
Author and all-around good cowpoke
Joined: Mar 22, 2000
1. you can make the path to the file storage directory a configurable parameter in web.xml with init-param tags. Convenient for user configuration. 2. you can make the path an environment variable 3. you can make the path relative to the web app installation - see ServleContext.getRealPath() 4. etc. plenty of other possibilities..... Bill