Skip to content

Instantly share code, notes, and snippets.

@NLKNguyen
Created September 28, 2015 21:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NLKNguyen/7d90fb15b088d3e48f1a to your computer and use it in GitHub Desktop.
Save NLKNguyen/7d90fb15b088d3e48f1a to your computer and use it in GitHub Desktop.
Tomcat Setup

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>

<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

<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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment