Spring Tutorial - Environmental Setup

Before setting up the spring framework there are some things that we need to setup. Things like JDK, Tomcat, eclipse that we should have in the system. This tutorial will take you through these setups.

Let us go through these setup steps one by one.

Step1Setup Java Development Kit (JDK)

Download Latest SDK, you can download the latest version of SDK from this link. Do follow the steps given in the link, install and configure the setup. Finally to refer to the directory that contains java and javac set up PATH and JAVA_HOME in the environment variables.

If the operating system is windows and the JDK installed directory is c: we have to put the below lines into C:\autoexex.bat file:

            set PATH=C:\jdk1.7\bin;%PATH%

            set JAVA_HOME = C:\jdk1.7

Otherwise, if you have windows operating system you can right-click on My Computer à Properties à Advanced à Environmental variables à update the PATH variable à OK.

In Unix OS, use C shell for putting the following code

            setenv PATH /usr/local/jdk1.7/bin:$PATH

            setenv JAVA_HOME /usr/local/jdk1.7

To confirm that the IDE knows the installed path of java we have to run the simple hello world java program. If the program compiles and runs successfully there is no problem if the program gives the error, follow the steps given in IDE documentation.

Step 2 – Installing apache common Logging API

Download the latest version of apache API from this link. After the download is complete unzip the zipped file into the convenient location in the drive. The directory will have the following jars and supporting documents.

        1.     Site

        2.     Commons-logging-1.1.1

        3.     Commons-logging-1.1.1-Javadoc

        4.     Commons-logging-1.1.1-sources

        5.     Commons-logging-adapters-1.1.1

        6.     Commons-logging-API-1.1.1

        7.     Commons-logging-tests

        8.     LICENCE

        9.     NOTICE

        10.  RELEASE-NOTES

Also, keep in mind to set up the classpath to this folder otherwise, apache tomcat will have problems in running.

Step3 – Setup IDE (Eclipse)

Eclipse’s latest version can be downloaded from the following location https://www.eclipse.org/downloads/. The downloaded file will be a zip file, unzip the file into the desired location/drive. Setup the path variable accordingly.

Double click on eclipse to start IDE.

Tip: Pin the exe file to the taskbar, so that every time we need to open eclipse we need not go to the complete folder.

 

Step 4 – Setup spring-related Framework libraries –

Remember, come to this step only if the previous steps are successfully executed. Follow below steps carefully to add spring framework:

        1.     For windows, we have to download .zip and for Unix, we have to download .tz

        2.     Go to https://www.eclipse.org/downloads/ .

        3.     Select the release version that is needed.

        4.     After clicking it will redirect to URL.

        5.     To download the spring framework select RELEASE-dist.zip for example if you have selected the version 5.2.8, select spring-5.2.8.RELEASE-dist.zip

        6.     The zip will contain the following files docs, libs, schema, license, release, notice.

        7.     The libs directory will contain all the required libraries.

        8.     If you are using other IDE, Setup the classpath properly to this directory otherwise at runtime the errors will come.

        9.     For the eclipse, we do not have to anything as all settings will be taken care of by the eclipse itself.

After all these steps we are good to go to proceed to the next tutorial.

The next chapter will be Spring tutorial - Spring Hello World Example.

Feel free to add something to this tutorial if I have missed something.


Post a Comment

0 Comments