Spring MVC Environment Setup - Spring MVC Framework

What is Spring MVC - Environment Setup?

This section will take you on preparing development environment to start with Spring Framework. This section also teaches us how to setup JDK, Eclipse and Tomcat on your machine before setting up Spring Framework.

Step 1 - Setup Java Development Kit (JDK):

Latest version of SDK can be downloaded from Oracle’s Java site: Java SE Downloads. Instructions to install JDK is provided in downloaded files. One can follow the instructions and configure the setup. PATH and JAVA_HOME environment variables need to set for referring to the directory which contains javac and java i.e., java_install_dir and java_install_dir/bin respectively.

Set the below variables in the C:\autoexec.bat file if we are running Windows and the JDK is installed in C:\jdk1.6.0_15.

If on Windows NT/2000/XP right-click on My Computer, select Properties, and Advanced, then on Environment variables. Then, you would update the PATH value and press the OK button.

On Unix (Solaris, Linux, etc.), if the SDK is installed in /usr/local/jdk1.6.0_15 while using C shell, we must keep the following in our .chsrc file.

If any one of the Integrated Development Environment (IDE) like Borland JBuilder, IntelliJ IDEA, Eclipse or Sun ONE Studio is used, need to compile and run a simple program to get a confirmation that IDE knows where we installed Java or should setup properly as per the document.

Step 2 - Install Apache Common Logging API:

Check and download the latest version of Apache Commons Logging API from http://commons.apache.org/logging/. Once the download is complete, unzip/unpack the binary distribution into a suitable location for example in C:\commons-logging-1.1.1 on windows, or /usr/local/commons-logging-1.1.1 on Linux/Unix. The location has the below jar files and other documents etc.

 Install Apache Common Logging API

CLASSPATH variable should be set in the directory or we will face problem when running our application.

Step 3 - Setup Eclipse IDE

It’s preferred to use the latest version of Eclipse installed as the examples in this tutorial are written using Eclipse IDE.

Download and install the latest Eclipse binaries from http://www.eclipse.org/downloads/. Once the download is complete, unzip/unpack the binary distribution into a suitable location for example in C:\eclipse on windows, or /usr/local/eclipse on Linux/Unix. Set the PATH variable appropriately.

We can start Eclipse simply by double clicking on eclipse.exe or by executing the following commands.

On Unix (Solaris, Linux, etc.), Eclipse can be started by executing the below commands.

Below result is displayed if startup is successful and everything is fine.

Setup Eclipse IDE

Step 4 - Setup Spring Framework Libraries

Once everything is set, we can move on to setting up Spring Framework. Below are the steps to follow for downloading and installing the framework.

  • Need to decide on whether to install Spring on Windows or Unix and proceed to next step. It is .zip file for Windows and .tz file for Unix.
  • Latest version of Spring Framework binaries can be downloaded from http://repo.spring.io/release/org/springframework/spring.
  • I have downloaded spring-framework-4.3.1.RELEASE-dist.zip on my Windows machine during this tutorial. After downloading, unzip the file which gives us the directory structure in E:\spring as follows.

Setup Spring Framework Libraries

We will see all the libraries in E:\spring\libs. CLASSPATH variable should be set in this directory or we will face problem when running our application. If Eclipse is used, then no need to set CLASSPATH as Eclipse will set it.

We are ready to move to our first Spring example once we are done with the last step. We will see the example in the next tutorial.

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Spring MVC Framework Topics