Deploy Java Application
Learn to deploy Java application /website on live server/tomcat server. Different ways to deploy Java application. The software used to upload files etc.
For Java Tomcat Hosting provider Click Here.
There are two ways of how you can deploy your applications – via FTP or using Tomcat Manager.
Software required for FTP is FileZilla. Most of the people prefer it as the best for transferring files to the server. Download FileZilla client.
I. Deploy Java application by FileZilla FTP Client:
- Upload your application web archive file (.war file) or directory with unpacked application. Place it into “/home/USERNAME/tomcat/
- If you want to make the application be available at ‘/’ context, the WAR file should have the ‘ROOT.war’ name. In the case of uploading a directory with an unpacked application, the directory name should be ‘ROOT’. Otherwise, the application will be deployed and be available at Urls like YOURDOMAIN/war_file_name or YOURDOMAIN/directory_name accordingly.
- Tomcat automatically tracks changes, and deploys new applications, undeploys removed applications and applies changes to running applications. However, if the changes haven’t applied automatically within 10 minutes, please restart Tomcat. via SSH or via the web interface in order to apply the changes and deploy your application manually.
II. Deploy Java application by Tomcat Manager:
Login to Tomcat Manager. If you have any troubles with login credentials for Tomcat Manager, you may find correct login info for Tomcat Manager application in the “/home/USERNAME/tomcat/conf/
If you have already uploaded application onto the server:
- Scroll down the page to the section called “Deploy directory or WAR file located on server”. Enter the context name preceded by “/”. (e.g.,”/myapp”) in the “Context Path” field.
- Leave the “XML Configuration file URL” filed blank.
- Locate WAR file and enter its absolute name. (e.g.,”/absolute/path/ROOT.war”) in the “WAR or Directory URL” field.
- Click the “Deploy” button. The page will reload.
- At the top of the page, verify that the message displayed is “OK – Deployed application at context path /myapp”. In the “Applications” section check that there is a line with the new application. The application is now ready and available at the specified URL.
If application is on your local PC, get Apache tomcat installed on your PC:
The technique described in the previous section works if you are able to copy WAR file to the server’s file system. If there is no way to do that for some reason, you can still deploy an application using a “remote deployment” feature. Please follow these steps in order to do this:
- Locate the WAR file on your local machine and rename it to the context name with “war” extension. e.g., myapp.war or to ROOT.war. (if ROOT name specified, application will be accessible at default context “/”).
- Access the Tomcat Web Application Manager and scroll down to the section called “WAR file to deploy”.
- Click on the “Browse…” button and select needed .war file on your local machine.
- Click “Deploy”. The browser will upload selected .war file to the server and Tomcat will deploy it afterwards.
Kindly note that if WAR file is large, it’s better to use FTP (rather than cPanel file manager) for its uploading.
Feel free to comment if facing any difficulty. Like us on social to get updates.