nativeInstallercodedx

Create a custom Java application

Before running the commands shown on this page, you should load the Bitnami stack environment by executing the installdir/use_APPNAME script (Linux and MacOS) or by clicking the shortcut in the Start Menu under “Start -> Bitnami APPNAME Stack -> Application console” (Windows). On OS X VMs, the installation directory is /opt/bitnami and OS X VM users can click the “Open Terminal” button to run commands. Learn more about the Bitnami stack environment and about OS X VMs.

Many users run a Bitnami stack as a development environment for their own projects (as opposed to running third-party applications). To create a custom Java application from scratch, follow the steps below. These steps assume that your application will live in the installdir/apps/myapp/ directory:

  • Run the following commands to create the directories:

    $ sudo mkdir installdir/apps/myapp
    $ sudo mkdir installdir/apps/myapp/conf
    
  • Create and edit the installdir/apps/myapp/conf/httpd-prefix.conf file and add the line below to it:

    Include "installdir/apps/myapp/conf/httpd-app.conf"
    
  • Create and edit the installdir/apps/myapp/conf/httpd-app.conf file and add the content below to it. This is the main configuration file for your application, so modify it further depending on your application’s requirements.

    <Location /myapp>
    ProxyPass ajp://localhost:8009/myapp
    </Location>
    

    NOTE: 8009 is the default port for the AJP connector. If you have customized the stack to use a different port, change it here as well.

  • Once you have created the files and directories above, add the following line to the end of the main Apache configuration file at installdir/apache2/conf/bitnami/bitnami-apps-prefix.conf, as shown below:

    Include "installdir/apps/myapp/conf/httpd-prefix.conf"
    
  • Restart the Apache Tomcat server.

You should now be able to access the application at http://localhost/myapp.

Last modification September 5, 2018