How to deploy Java web application project from Eclipse to live Tomcat server?

后端 未结 4 2173
终归单人心
终归单人心 2020-12-13 07:37

I have developed an web application using HTML, Java Servlet and all. While developing I was using Tomcat to deploy it in order to test it.

Now my development is don

4条回答
  •  忘掉有多难
    2020-12-13 08:15

    1. You will have to build a WAR of the project. You can do this

      • in eclipse: right click on the project, Click "Export", and choose war file in the dialog (and mention, the destination, name and all)
      • via ant using the war task

        The ant option is better because when you have multiple developers on the project and the code is in version control, it is easier to get the project automatically (using ant) and build a war. (you have version control, don't you?)

      But this is more of an operational difference (albeit an important one) but the war created in either way are same

    2. Deploy the war to the server

      • You can manually copy the war file to the $TOMCAT_HOME/webapps directory (See the "Creating and Deploying a WAR File" section on this article)

      • You can use the Tomcat 6 "Manager" application.

    Update
    You said that you are using MySql also. MySql should be installed on a server (it can be on the same server) and the configuration should be changed (username, password, server details) so that the application connects to the same database (I am sure you are not hard coding database details and credentials in your application and reading them from some configuration, this is the configuration that has to be changed)

提交回复
热议问题