This article shows you how to change server location and deploy path for Apache Tomcat server in Eclipse IDE. You know, by default Eclipse publishes Java web applications in the workspace metadata directory so you see the option Use workspace metadata (does not modify Tomcat installation) in the Tomcat settings view in Eclipse:

Tomcat Server Locations in Eclipse

For example, if your workspace directory is E:\Java\JavaEE, then you see that Eclipse deploys the application in the server location which is a directory looks something like this:

e:\Java\JavaEE\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps

What if you want to deploy your Java web applications in another directory: Tomcat installation directory or your own directory? But you see all the options for Server Locations are grayed out, right? So how to make change?

Here you will see how.

Read the instruction carefully:

Server must be published with no modules present to make changes.

This sounds logical because you can’t change server location and deploy path if there are still applications deployed on the default path. That means if you want to change server location you have to delete all the currently deployed applications on the server. To remove a deployed application from the server, simple select it in the server view and press Delete key. The server must be empty like this:

Tomcat server is empty

And when there’s no more application, you see all the options for Server Locations are enabled:

Tomcat Server Locations enabled in Eclipse

Now, you can change the server location and deploy path as you wish. For example, to make Eclipse deploy your Java web applications in webapps directory of Tomcat, make the following changes:

Change server location and deploy path for Tomcat

Then click Save (Ctrl + S) to make the changes take effect. Now drag and drop the project from the Project Explorer view to Servers view to deploy it to a new location.

Similarly, you can specify your own location for server location and deploy path, for example:

Use custom location

With this change, the server configuration is copied to the F:\WebApps directory and the applications are deployed in the F:\WebApps\Deployed directory. And note that in this case, the server path must not be the workspace directory.

 

Other Tomcat Tutorials:


About the Author:

is certified Java programmer (SCJP and SCWCD). He began programming with Java back in the days of Java 1.4 and has been passionate about it ever since. You can connect with him on Facebook and watch his Java videos on YouTube.



Add comment

   


Comments 

#3RMeier2023-07-01 12:46
Not good explained! How do I get the dialogue. YOu do not explain!
Quote
#2Nam2019-09-18 17:25
Quoting priya:
after deleting the tomcat server.server location does not enabled ??????

Note that "Server must be published with no modules present to make changes." - meaning that you can only change deployment path if no webapps are added to the server.
Quote
#1priya2019-09-14 03:58
after deleting the tomcat server.server location does not enabled ??????
Quote