This is a series and it would make a lot of sense if read in a sequence. You can find all the posts under the heading “Spring Beginners to Professionals“. This is the sixth post of the series. As I promised, in this post we will learn how to setup the development environment for Spring development.
As we will start writing some code snippets and talk about components of Spring, I would suggest you to take some time and setup your development environment and get ready for some action.
Experience developers can skip this pose in case they already have the development environment. Here I am using a Windows 64 bit operating system. Few of you might be using Mac/Linux. The setup instructions more or less remain the same.
It is a three step process which includes
- Installing JDK
- Installing Eclipse IDE
- Installing Maven
All three are basic steps and I believe you must have done this previously in your Java development tasks. In that case you can skip to the next post. For the first timers here, I would list down the steps in detail.
You need to download JDK 8 (if you prefer other versions of Java, please install that one) from the oracle website. Make sure to choose the right version, there is a 32bit and a 64bit one. Once downloaded, just double click and the installer will guide you to install JDK.
Once the JDK installation is done, you need to set the JAVA_HOME classpath variable to the directory where Java is installed and add %JAVA_HOME%/bin; to the system path. To verify if the path and variable is set properly, open up a command prompt and test the installation.
Type echo %JAVA_HOME% and verify if variable is set to the right directory shown by the output of the command. Type java -version to check if the version you installed is reflected properly.
If you can verify both of these, then you have successfully setup Java.
Once Java is installed, lets complete the Maven Installation (You can skip this step as Eclipse comes with inbuilt maven plugin). If you still want to install an external maven, you can download the latest GA version of Maven from https://maven.apache.org/download.cgi
You can download the binary distribution zip in any directory and unzip it. I generally prefer putting this in a directory where the path contains no spaces like C:/Maven. After unzipping, now set a class path variable MAVEN_HOME to the directory where maven distribution is unzipped. Also add %MAVEN_HOME%/bin; to the system path.
To verify if the path and variable is set properly, open the command prompt and test the setup. Type echo %MAVEN_HOME% and verify if the variable is set to the right directory shown by the output command.
Type mvn -version to check if the version you downloaded is reflected properly.
Now we are almost done! Just download eclipse for J2EE developers from here . Make sure to choose the right architecture version (32bit or 64 bit). Upon download, unzip it to any directory. In the directory, just click on the eclipse icon and Eclipse will start.
We are done with the setup and we are ready to dive deep into the Spring Framework.
By the end of this post, I am sure you have successfully setup the environment and you are ready to dive deep in. Please make sure to follow the respective steps for Mac or Linux. In the next post, we will uncover the secret of Spring Beans and more. Stay connected.