'Apache Tomcat under Windows: Changing webapps default directory
I am deploying my Java application with Ant. Unfortunately my test deployment on the local machine doesn't work because of Vista. The Program Files directionaries are protected and i don't want to start Ant or Eclipse as an Admin. So i had the idea to move my webapps folder to a workspace subfolder, so i can use relative paths in Ant as well.
The solutions seems to be to modify the Host element in the server.xml. With Linux it isn't such a deal:
<Host name="localhost" appBase="/path/to/webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
But with Windows i don't get it right. I tried every possible combinations i could imagine, like:
C://Users//maerch//Workspaces//Tomcat6.0_webapps
C:/Users/maerch/Workspaces/Tomcat6.0_webapps
C:\Users\maerch\Workspaces\Tomcat6.0_webapps
C:\\Users\\maerch\\Workspaces\\Tomcat6.0_webapps
C://Users//maerch//Workspaces//Tomcat6.0_webapps\\
C:/Users/maerch/Workspaces/Tomcat6.0_webapps/
C:\Users\maerch\Workspaces\Tomcat6.0_webapps\
C:\\Users\\maerch\\Workspaces\\Tomcat6.0_webapps\\
The path is also correct, but it doesn't work. There are also no error messages in the log files neither the browser shows a 404 message or anything else. Just a white page without title and so on. Can anyone help?
Solution 1:[1]
The following should work in Windows:
C:/Users/maerch/Workspaces/Tomcat6.0_webapps/
/Users/maerch/Workspaces/Tomcat6.0_webapps/
Windows also support Unix's slash (/), so it's a good idea to use this instead of Windows's (\). Also the 'default root' for Windows is C:, so you shouldn't need it in an absolute path.
I don't think this is a problem with the path. Perhaps you could try use a relative path:
"../../../Users/..."
It may also be good idea to install Tomcat in a directory where you have full access.
Solution 2:[2]
for windows
appBase="c://webapps2"
Solution 3:[3]
What if you copy the same webapps directory to another location and change the path in server.xml file. If we would do this then definitely i believe we won't have any probs because whenever things webapps need to deploy an application it will have.
Solution 4:[4]
I tried in Apache tomcat version 8.5 and simply using appBase="c:\path\to\webapps" worked seamlessly
Solution 5:[5]
If you are using Apache Tomcat then update following file C:\Program Files\Apache Software Foundation\ABCFolder\bin\Tomcat9w.exe
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | kgiannakakis |
| Solution 2 | |
| Solution 3 | Ahmed Ashour |
| Solution 4 | nandan |
| Solution 5 | Shivam Srivastava |


