freemarker tutorials


**Libraries Used**

* [FreeMarker 2.3.23](
* [Spring MVC 4.2](
* Javax Servlet API 3.1.0

## Step 1: Download or clone the FreeMarker Tutorials project

[Download and extract the FreeMarker Tutorials Github project]( or clone it using git (git clone

## Step 2: Compile the Hello World project

Open up a console window (Command prompt for Windows users or Terminal for OS X users) and navigate to the tutorials/01-hello-world directory. Run mvn compile war:inplace.

mvn compile war:inplace

(If you don’t have Maven, follow the installation instructions here: [Installing Java and Maven](../00-installing-java-and-maven/))

This will download the dependencies and compile the Java files.

## Step 3: Point Tomcat at your webapp directory

1. In the [previous tutorial](../00-running-a-server-locally) we set up a Tomcat server. Make sure your server is still running!

* Windows users: Open up Command Prompt, type catalina start and press enter
* OS X users: Open up Terminal, type catalina start and press enter

2. Navigate to your Tomcat installation folder, and find the conf/Catalina/localhost directory and create a context file called **hello-world.xml**.

* Windows users: If you followed the previous tutorial’s instructions, Windows users can navigate directly to the folder by copying and pasting %CATALINA_HOME%\conf\Catalina\localhost into a Windows explorer window.

![Windows 7 XML file](images/win7-catalina-home.png)

* OS X users: In Terminal you can do this (Replace **8.0.26** with your version of Tomcat):

cd /usr/local/Cellar/tomcat/8.0.26/libexec/conf/Catalina/localhost
vi hello-world.xml


3. Inside hello-world.xml, add the following (Replace **PATH_TO_FREEMARKER_TUTORIALS** with
wherever you have the FreeMarker tutorials project.):

<?xml version="1.0" encoding="utf-8"?>
<Context docBase="PATH_TO_FREEMARKER_TUTORIALS/01-hello-world/src/main/webapp"
path="" reloadable="true" />


4. You should now be able to access the FreeMarker Hello World webapp at [http://localhost:8080/hello-world/](http://localhost:8080/hello-world/).