Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I deploy my Java files to my Tomcat Server automatically?

I have a web project in Eclipse which includes a Tomcat server. The Tomcat server is installed in Path C:\Program Data ... and my Workspace from Eclipse is in D:\Webproject.

Now if I have to edit my java servlet classes, I have to copy the class and JSP files from D:\Webproject to C:\Program Data\Tomcat\Webapps.... . This takes me a lot of time.

Is there any solution where the data is automatically deployed i.e. the edited classes and JSP are moved to my tomcat folder under C:.. ?

like image 246
java java Avatar asked Jun 05 '13 08:06

java java


People also ask

What is auto deployment in Tomcat?

autoDeploy set to "true" and a running Tomcat allows for: Deployment of . WAR files copied into the Host appBase . Deployment of exploded web applications which are copied into the Host appBase . Re-deployment of a web application which has already been deployed from a .

Can I deploy JAR file in Tomcat?

Tomcat JAR deployment options There are three recommended options to make this happen: Package the JAR file in the WEB-INF\lib folder of the Java web application; Place the JAR file in the \lib subfolder of the Apache Tomcat installation; Configure a folder for shared JAR files by editing Tomcat's common.

What are the steps to deploy a Java web application using Apache Tomcat?

Step 1: Install Tomcat on OpenShift. Step 2: Create a new project. Step 3: Create the Java web application. Step 4: Access the Tomcat Manager on OpenShift.


1 Answers

Eclipse can do all that work for you.

To add the Tomcat server in eclipse:

  • Open the 'Servers' view by going in Window->Show view->Servers.
  • Do a right click in the 'Servers' view and select New->Server.
  • Select Apache\Tomcat vX.X Server (where X.X is your Tomcat version) and click Next.
  • Enter your Tomcat installation directory and click Finish.

To deploy your project to the server:

  • In the 'Servers' view, right click on the Tomcat server and choose 'Add and Remove...' and add your project, then press Finish.

You can then start/stop/debug/restart the server by right clicking on it.

When you modify a class/jsp it should be automatically deployed.

You can also force a republish of your project by right clicking on your project name after expanding the Tomcat server entry.

Double click on the Tomcat server entry if you need to modify the configuration of your server.

like image 200
Olivier Masseau Avatar answered Oct 20 '22 04:10

Olivier Masseau