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

68,444

Solution 1

  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)

Solution 2

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

Solution 3

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.

Share:
68,444
mahesh
Author by

mahesh

Certified Java Developer, Java Training provider, Website Design / Development, Graphic Design, PHP, ASP.NET, HTML, CSS, Web Application Development, iPhone, iPad, Wordpress, Open Source Customization

Updated on March 12, 2020

Comments

  • mahesh
    mahesh about 4 years

    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 done and I want to make it live. 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?

    So please help me if you know to answer?

    My Project Structure

         ProjectName
             ->src
                   ->beanClass
                           ->class1
                           ->Class2
                   ->easyServlet    
                           ->Servlet1
                           ->Servlet2
                           ->Servlet3
                   ->easyTrans
                           ->Class1    
                           ->Class2    
                           ->Class3    
                           ->Class4    
             ->build
             ->WebContent
                   ->META-INF
                           ->MENIFEST.mf
                   ->WEB-INF
                           ->lib(contain javascript files)
                           ->web.xml
                   ->html1
                   ->html2
                   ->html3
                   ->html4
                   ->html5
    

    I am also using MySql so what I have to about it..