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 the unpackWARsoption 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:

  1. Select your public_html directory.
  2. Click New Folder and enter the name that you wish to use for the folder.
  3. Select your new folder in the center pane of the interface.
  4. Click Upload.
  5. Click Choose File.
  6. Browse to the Java WAR package on your local system and select it. Click Open to upload the file.
  7. Select the file in the center pane of the interface. Click Rename.
  8. Change the file extension from .war to .zip and click Rename File.
  9. Select the .zip file and click Extract.
  10. Select the .htaccess file inside your public_html directory.

    Note:

    If you do not see the .htaccess file inside your public_html directory, perform the following steps:

    1. Exit the File Manager interface.
    2. Refresh your cPanel interface.
    3. Click File Manager and select the Show Hidden Files (dotfiles). option. 
    4. Click Go.
  11. Click Edit.
  12. Click Edit in the Text Editor window.
  13. Enter the following text into the text box:

    1
    2
    SetHandler jakarta-servlet
    SetEnv JK_WORKER_NAME ajp13
  14. Click Save Changes.
  15. Access your Java application with the http://example.com/$exampledirectory/$examplejavaapplication URL.

    Notes:

    • Replace example.com with your domain name.
    • Replace $exampledirectory with the directory of the Java application
    • Replace $examplejavaapplication with the name of the Java application.

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:

  1. Upload your Java WAR package to your public_html directory.
  2. Run the  unzip filename.war command to extract the package.

    Note:

    In the above command, replace filename.war with the name of your Java WAR package file.

  3. Edit the .htaccess file within your public_html directory to include the following text:

    1
    2
    SetHandler jakarta-servlet
    SetEnv JK_WORKER_NAME ajp13
  4. Save the changes.
  5. Access your Java application with the http://example.com/$exampledirectory/$examplejavaapplication URL.

    Notes:

    • Replace example.com with your domain name.
    • Replace $exampledirectory with the directory of the Java application
    • Replace $examplejavaapplet with the name of the Java application
Was this answer helpful? 81 Users Found This Useful (84 Votes)