Overview
Many Java applications are available in WAR packages that are easy to install on your server.
Note:
If your application is not available in a WAR package, your server administrator must manually install it.
If your account supports Java applications and your Java application is available in a WAR package, use one of the following processes to install a Java application on your domain.
How to deploy Java WAR packages
Notes:
- Tomcat does not automatically deploy WAR files in the
/home/username/public_html/$filename/directory because EasyApache turns off theunpackWARsoption for security reasons. - The Apache Tomcat project provides a sample WAR file that you can use to verify that Java WAR packages function on your domain. For more information, view Tomcat's Sample Application website. Make certain to upload and extract the file with one the following methods.
To deploy a Java WAR package, use either cPanel's File Manager interface (Home >> Files >> File Manager) or the command line interface (CLI).. To upload the package into your public_html directory and then extract it, use one of the following methods:
How to deploy a Java WAR package via File Manager
To deploy a Java WAR package via cPanel's File Manager interface, perform the following steps:
- Select your
public_htmldirectory. - Click New Folder and enter the name that you wish to use for the folder.
- Select your new folder in the center pane of the interface.
- Click Upload.
- Click Choose File.
- Browse to the Java WAR package on your local system and select it. Click Open to upload the file.
- Select the file in the center pane of the interface. Click Rename.
- Change the file extension from
.warto.zipand click Rename File. - Select the
.zipfile and click Extract. -
Select the
.htaccessfile inside yourpublic_htmldirectory.Note:
If you do not see the
.htaccessfile inside yourpublic_htmldirectory, perform the following steps:- Exit the File Manager interface.
- Refresh your cPanel interface.
- Click File Manager and select the Show Hidden Files (dotfiles). option.
- Click Go.
- Click Edit.
- Click Edit in the Text Editor window.
-
Enter the following text into the text box:
12SetHandler jakarta-servletSetEnv JK_WORKER_NAME ajp13 - Click Save Changes.
-
Access your Java application with the
http://example.com/$exampledirectory/$examplejavaapplicationURL.Notes:
- Replace
example.comwith your domain name. - Replace
$exampledirectorywith the directory of the Java application Replace $examplejavaapplicationwith the name of the Java application.
- Replace
How to deploy a JAVA WAR package via CLI
Important:
If you do not have shell access, you must use the How to deploy a Java WAR package via File Manager method.
To deploy a Java WAR package via the CLI, perform the following steps:
- Upload your Java WAR package to your
public_htmldirectory. -
Run the
unzip filename.warcommand to extract the package.Note:
In the above command, replace
filename.warwith the name of your Java WAR package file. -
Edit the
.htaccessfile within yourpublic_htmldirectory to include the following text:12SetHandler jakarta-servletSetEnv JK_WORKER_NAME ajp13 - Save the changes.
-
Access your Java application with the
http://example.com/$exampledirectory/$examplejavaapplicationURL.Notes:
- Replace
example.comwith your domain name. - Replace
$exampledirectorywith the directory of the Java application - Replace
$examplejavaappletwith the name of the Java application
- Replace