Skip to content

Instantly share code, notes, and snippets.

@NLKNguyen
Created September 28, 2015 21:32
Show Gist options
  • Save NLKNguyen/7d90fb15b088d3e48f1a to your computer and use it in GitHub Desktop.
Save NLKNguyen/7d90fb15b088d3e48f1a to your computer and use it in GitHub Desktop.

Revisions

  1. NLKNguyen created this gist Sep 28, 2015.
    46 changes: 46 additions & 0 deletions instruction.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,46 @@
    *From `Professional Java for Web Applications` page 24*
    ## Configure Tomcat for first use

    ### Add user
    In file: $TOMCAT_HOME/conf/tomcat-users.xml

    Add in between `<tomcat-users>` and `</tomcat-users>`

    ```XML
    <user username="admin" password="admin" roles="manager-gui,admin-gui" />
    ```

    ## Add support for Java SE 8
    In file: $TOMCAT_HOME/conf/web.xml

    Search for `org.apache.jasper.servlet.JspServlet`
    Below the existing `<init-param>` and `</init-param>`, add the following

    ```XML
    <init-param>
    <param-name>compilerSourceVM</param-name>
    <param-value>1.8</param-value>
    </init-param>
    <init-param>
    <param-name>compilerTargetVM</param-name>
    <param-value>1.8</param-value>
    </init-param>
    ```
    ### Make sure JAVA_HOME variable is set
    Try this to see if it points to java jdk
    ```
    In Windows:
    > echo %JAVA_HOME%
    ```
    Otherwise, set the system environment variable, for example
    ```
    JAVA_HOME
    C:\Program Files\Java\jdk1.8.0_60
    ```

    ### Test
    ```
    > cd C:\Program Files\Apache Software Foundation\Tomcat 8.0\
    > bin\startup.bat
    ```
    If everything is ok, `localhost:8080` will show the Apache Tomcat page