Getting and installing Tomcat
Now that the technology stack of our project is clear, let's start setting up the environment. I am assuming you have a completely empty system, so I am starting with the installation of Tomcat. If you already have Tomcat, skip ahead.
For this tutorial I will assume you are using Windows, because that is (up till now) what most developers use. If you use a different operating system, don't worry. Installing Tomcat on OS's other than Windows is documented on http://tomcat.apache.org/.
I will be using Tomcat 7.0.28, but the version is not important for our project. Spring MVC will run on any Tomcat version. If you don't already have Tomcat installed, just get the latest release. If you do have Tomcat installed, you can use that installation.
Installing Tomcat on Windows
Follow these steps to install Tomcat as an application that is started manually. If you want to install Tomcat as a service, download the service installer and don't follow these steps.
- Since you are a java developer, you probably have a JDK installed. If you don't have a Java Development Kit, install that first. Go to oracle.com and get the latest Java SE JDK and install it.
- Add the JAVA_HOME environment variable to
Windows and point it to your JDK installation root folder. Test
this by opening a command prompt and typing echo
%JAVA_HOME%. Your Java installation folder should show
- Go to http://tomcat.apache.org/ and get the latest release of Tomcat. I always download the 64-bit Windows zip.
- Unzip the ZIP to a convenient location, C:\tomcat or C:\apache-tomcat-[version] for example.
- Add an environment variable called
CATALINA_HOME to Windows and have it point to
Tomcat's installation folder.
Again, test it by typing echo %CATALINA_HOME% in the command prompt. Note: you might have to open a new command prompt, because the one you used in step 2 doesn't know of your new environment variable yet.
- Now start Tomcat by typing %CATALINA_HOME%\bin\startup.bat in the command prompt.
- You can now test Tomcat by visiting http://localhost:8080 with
your web browser. This should bring you to Tomcat's default