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

后端 未结 4 2156
终归单人心
终归单人心 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 07:58

    For that we have live server but as I am new to all this I dont know how to deploy my java web application on live server?

    I assume by this you meant , you have a public IP assigned to a server. Now you can install tomcat into this server and open the tomcat port for public and you will be able to access.

    Now build a war file of your webapplication and put it into web-apps dir of the tomcat and start the server

    0 讨论(0)
  • 2020-12-13 07:59

    Deploy the war to the server

    You can manually copy the war file to the $TOMCAT_HOME/webapps directory.

    You can use the Tomcat 6 "Manager" application.

    0 讨论(0)
  • 2020-12-13 08:00

    Making a few assumptions here. You need

    1. A tomcat instance running on your production server
    2. Permissions to make changes to the tomcat instance
    3. A war file that bundles your application

    If you have both, then you need to navigate to the Tomcat manager page and follow the instructions to upload your war file.

    0 讨论(0)
  • 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)

    0 讨论(0)
提交回复
热议问题