
- Spring MVC Basics
- Spring MVC - Home
- Spring MVC - Overview
- Spring MVC - Environment Setup
- Spring MVC - Hello World Example
- Spring MVC - Form Handling
- Spring MVC - Form Handling
- Spring MVC - Page Redirection
- Spring MVC - Static Pages
- Spring MVC - Form Tag library
- Spring MVC - Textbox
- Spring MVC - Password
- Spring MVC - Textarea
- Spring MVC - Checkbox
- Spring MVC - Checkboxes
- Spring MVC - Radiobutton
- Spring MVC - Radiobuttons
- Spring MVC - Dropdown
- Spring MVC - Listbox
- Spring MVC - Hidden
- Spring MVC - Errors
- Spring MVC - Upload
- Spring MVC - Handler Mapping
- Bean Name Url Handler Mapping
- Controller Class Name Handler Mapping
- Simple Url Handler Mapping
- Spring MVC - Controller
- Spring MVC - Multi Action Controller
- Properties Method Name Resolver
- Parameter Method Name Resolver
- Parameterizable View Controller
- Spring MVC - View Resolver
- Internal Resource View Resolver
- Spring MVC - Xml View Resolver
- Resource Bundle View Resolver
- Multiple Resolver Mapping
- Spring MVC - Integration
- Spring MVC - Hibernate Validator
- Spring MVC - Generate RSS Feed
- Spring MVC - Generate XML
- Spring MVC - Generate JSON
- Spring MVC - Generate Excel
- Spring MVC - Generate PDF
- Spring MVC - Using log4j
- Spring Questions and Answers
- Spring - Questions and Answers
- Spring Useful Resources
- Spring MVC - Quick Guide
- Spring MVC - Useful Resources
- Spring MVC - Discussion
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Spring MVC - Environment Setup
This chapter will guide you on how to prepare a development environment to start your work with Spring Framework. It will also teach you how to set up JDK, Maven and Eclipse on your machine before you set up Spring Framework −
Setup Java Development Kit (JDK)
You can download the latest version of SDK from Oracle's Java site − Java SE Downloads. You will find instructions for installing JDK in downloaded files, follow the given instructions to install and configure the setup. Finally set PATH and JAVA_HOME environment variables to refer to the directory that contains java and javac, typically java_install_dir/bin and java_install_dir respectively.
If you are running Windows and have installed the JDK in C:\jdk-11.0.11, you would have to put the following line in your C:\autoexec.bat file.
set PATH=C:\jdk-11.0.11;%PATH% set JAVA_HOME=C:\jdk-11.0.11
Alternatively, on Windows NT/2000/XP, you will have to right-click on My Computer, select Properties → Advanced → Environment Variables. Then, you will have to update the PATH value and click the OK button.
On Unix (Solaris, Linux, etc.), if the SDK is installed in /usr/local/jdk-11.0.11 and you use the C shell, you will have to put the following into your .cshrc file.
setenv PATH /usr/local/jdk-11.0.11/bin:$PATH setenv JAVA_HOME /usr/local/jdk-11.0.11
Alternatively, if you use an Integrated Development Environment (IDE) like Borland JBuilder, Eclipse, IntelliJ IDEA, or Sun ONE Studio, you will have to compile and run a simple program to confirm that the IDE knows where you have installed Java. Otherwise, you will have to carry out a proper setup as given in the document of the IDE.
Setup Eclipse IDE
All the examples in this tutorial have been written using Eclipse IDE. So we would suggest you should have the latest version of Eclipse installed on your machine.
To install Eclipse IDE, download the latest Eclipse binaries from www.eclipse.org/downloads. Once you download the installation, unpack the binary distribution into a convenient location. For example, in C:\eclipse on Windows, or /usr/local/eclipse on Linux/Unix and finally set PATH variable appropriately.
Eclipse can be started by executing the following commands on Windows machine, or you can simply double-click on eclipse.exe
%C:\eclipse\eclipse.exe
Eclipse can be started by executing the following commands on Unix (Solaris, Linux, etc.) machine −
$/usr/local/eclipse/eclipse
After a successful startup, if everything is fine then it should display the following result −

Install Apache Common Logging API
You can download the latest version of Apache Commons Logging API from https://commons.apache.org/logging/. Once you have downloaded the installation, unpack the binary distribution into a convenient location.
For example – C:\commons-logging-1.1.1 on windows, or /usr/local/commons-logging1.1.1 on Linux/Unix. This directory will have the following jar files and other supporting documents, etc.

Make sure you set your CLASSPATH variable on this directory properly, otherwise you will face problem while running your application.
Setup Spring Framework Libraries
Now if everything is fine, then we can proceed to setup the Spring Framework. Following are the steps to download and install the framework on the machine.
Make a choice whether you want to install Spring on Windows or UNIX and then proceed to the next step to download .zip file for windows and .tz file for Unix.
Download the latest version of Spring framework binaries from https://repo.spring.io/release/org/springframework/spring.
We have downloaded the spring-5.3.14-dist.zip on the Windows Machine and when we unzip the downloaded file, it will give out the directory structure inside – E:\spring as follows.

You will find all the Spring libraries in the directory E:\spring\libs. Make sure you set your CLASSPATH variable on this directory properly; otherwise, we will face a problem while running the application. If we use Eclipse, then it is not required to set the CLASSPATH because all the setting will be done through Eclipse.
Once you are done with this last step, you are ready to proceed for your first Spring Example, which you will see in the next chapter.