Prerequisites
Before writing any codes, please install the latest JDK 8, Apache Maven, and your favorate IDE.
Java 8
Oracle Java 8 is recommended. For Windows user, just go to Oracle Java website to download it and install into your system. Redhat has just released a OpenJDK 8 for Windows user at DevNation 2016, if you are stick on the OpenJDK, go to Redhat Developers website and get it.
Most of the Linux distributions includes the OpenJDK, install it via the Linux package manager.
Optionally, you can set JAVA_HOME environment variable and add <JDK installation dir>/bin in your PATH environment variable.
Type this command in system terminal to verify your Java environment installed correctly.
Apache Maven
Download the latest Apache Maven from http://maven.apache.org, and uncompress it into your local system.
Optionally, you can set M2_HOME environment varible, and also do not forget to append <Maven Installation dir>/bin your PATH environment variable.
Type the following command to verify Apache Maven is working.
If you are a Gradle fan, you can use Gradle as build tool. Gradle could be an alternative of Apache Maven.
Lombok
I would like use Lombok to simply codes and make the codes clean. Go to Lombok project to get know with Lombok.
There is a good introduction to Lombok from baeldung's blog.
IDE
The source codes are Maven based, it is IDE independent, so you can choose your favorite IDE. Nowadays the popular IDEs includes Eclipse, IDEA, NetBeans.
We will use JPA criteria metadata to provide type safe query, and use Lombok to simplify the codes, you have to enable Annotation Processing feature in your IDEs.
Spring ToolSuite
Spring Tool Suite is an Eclipse based IDE, and provides a lot of built-in Spring supports, it is highly recommended for new Spring users.
Go to Spring official site, download a copy of Spring Tool Suite. At the moment, the latest version is 3.8.
Alternatively, you can download a copy of Eclipse Java EE bundle from Eclise official website, and install the STS plugin from Eclipse Marketplace.
Extract the files into your local disk. Go to root folder, there is STS.exe file, double click it and starts up Spring Tool Suite.
Go to Windows/Preference menu, and open Preference dialog
Search
Annotation
...Expand Compiler/ Annotation Processing , enable Annotation Processing.
Expand Maven/Annotation Processing, enable Annotation Processing. If it does not exists, install m2e-apt in Maven/Discovery firstly.
Apply all changes.
Go to Lombok project website, and follow the official the installation guideline) to install Lombok plugin into your Eclipse IDE.
Intellij IDEA
No doubt, Intellij IDEA is the most productive Java IDE. It includes free and open source community version and enterprise version.
Go to File / Settings
Search
annotation processor
Enable Annotation processing
You can install Lombok plugin from IDEA plugin manager to get Lombok support in your IDEA.
Go to File / Settings / Plugins
Click on Browse repositories...
Search for
Lombok Plugin
Click on Install plugin
Restart IDE
NetBeans
NetBeans is the simplest IDE for Java development, which was originally brought by Sun microsystem(and later maintained by Oracle), it is free and open source.
Now Oracle denoted it as an incubator project under Apache Foundation.
Download a copy of NetBeans from NetBeans website(it is still working before Apache hand over it).
For NetBeans users, there is no need to setup Annotation Processing and Lombok, NetBeans has activated Annotation processing capability by default.
In the next posts, let's try to create a project skeleton for our blog sample application.
Last updated