Book Image

SPRING COOKBOOK

Book Image

SPRING COOKBOOK

Overview of this book

Table of Contents (19 chapters)
Spring Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Installing Java, Maven, Tomcat, and Eclipse on Windows


We will first install Java 8. Then, we will install Maven 3, a build tool similar to Ant, to manage the external Java libraries that we will use (Spring, Hibernate, and so on). Maven 3 also compiles source files and generates JAR and WAR files. We will also install Tomcat 8, a popular web server for Java web applications, which we will use throughout this book. JBoss, Jetty, GlassFish, or WebSphere could be used instead. Finally, we will install the Eclipse IDE, but you could also use NetBeans, IntelliJ IDEA, and so on.

How to do it…

Install Java first, then Maven, Tomcat, and Eclipse.

Installing Java

  1. Download Java from the Oracle website http://oracle.com. In the Java SE downloads section, choose the Java SE 8 SDK. Select Accept the License Agreement and download the Windows x64 package. The direct link to the page is http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html.

  2. Open the downloaded file, launch it, and complete the installation.

  3. Navigate to Control Panel | System and Security | System | Advanced system settings | Environment Variables….

  4. Add a JAVA_HOME system variable with the C:\Program Files\Java\jdk1.8.0_40 value. Change jdk1.8.0_40 to the actual folder name on your system (this depends on the version of Java, which is updated regularly).

  5. Test whether it's working by opening Command Prompt and entering java –version.

Installing Maven

  1. Download Maven from the Apache website http://maven.apache.org/download.cgi. Choose the Binary zip file of the current stable version:

  2. Uncompress the downloaded file.

  3. Create a Programs folder in your user folder.

  4. Move the extracted folder to it.

  5. Navigate to Control Panel | System and Security | System | Advanced system settings | Environment Variables….

  6. Add a MAVEN_HOME system variable with the path to the Maven folder. For example, C:\Users\jerome\Programs\apache-maven-3.2.1.

  7. Open the Path system variable.

  8. Append ;%MAVEN_HOME%\bin to it.

  9. Test whether it's working by opening a Command Prompt and entering mvn –v.

Installing Tomcat

  1. Download Tomcat from the Apache website http://tomcat.apache.org/download-80.cgi and choose the 32-bit/64-bit Windows Service Installer binary distribution.

  2. Launch and complete the installation.

  3. Tomcat runs on the 8080 port by default. Go to http://localhost:8080/ to check whether it's working.

Installing Eclipse

  1. Download Eclipse from http://www.eclipse.org/downloads/. Choose the Windows 64 Bit version of Eclipse IDE for Java EE Developers.

  2. Uncompress the downloaded file.

  3. Launch the eclipse program.