2.2 Installation of the Required Software Packages

We need the three components listen in Tab. 2-1 to be installed on our system. The following descriptions assume that a 64-bit version of Windows 7 has been installed. If you are using a different operating system, you should refer to the corresponding installation instructions for the individual software packages. Since we are using a Windows 7 system, we will always use a backslash “\” when specifying paths  .

Software Package Internet Source
Java SE 8 http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
Maven 3.2.1 http://maven.apache.org/download.html
WildFly 8.1.0 http://wildfly.org/downloads/

Tab.2-1 Required Software Packages and their Internet Sources

2.2.1 Installation of Java SE 8

Every Windows 7 system comes with a JRE (Java Runtime Environment) preinstalled. However, since we want to develop software, we require the programming tools in the JDK (Java Development Kit). If the most recent version of the JDK (currently version 8) is already installed on your system and the environment variables JAVA_HOME and PATH are correctly defined, you can skip this section.

As a first step, we will download an executable file (e.g.  jdk-8u5-windows-x64.exe for 64-bit Windows systems) and run it. A dialog box will then be displayed to guide us through the installation process. Following the installation, we must define the following environment variables:

  1. We will define the environment variable JAVA_HOME, which will contain the full path to the installation directory of the JDK (e.g. C:\ Program Files\Java\jdk1.8.0_05).
  2. We will append the bin-directory of the JDK to the Windows PATH variable using the new environment variable JAVA_HOME (%JAVA_HOME%\bin).
Setting the Environment Variables
Windows 7: Control Panel → System and Security → System → “Advanced System Settings” link → “Environment Variables” button. An environment variable in Windows stores a value under a particular name. This provides flexibility within the operating system during the installation and execution of programs. Example: Multiple JDK versions can be located in different installation directories on the same system. The decision about which version is actually used can be controlled through the environment variable JAVA_HOME, by using it instead of an absolute path in the PATH environment variable. Note: Environment variables in Windows can be defined system-wide or per user. System-wide definition of variables is preferable in our case, so that the most recent JDK can be used by all users.

After that, we can check our installation using the command line. We will open the Windows command prompt (program cmd.exe). After the prompt is started, the command line will be located in the Home directory (e.g. c:\users\ms) of the currently logged-in user (here: ms). We can review our settings by requesting the value of the environment variable JAVA_HOME using the echo command:

C:\Users\ms>echo %JAVA_HOME%
C:\Program Files\Java\jdk1.8.0_05

The JRE (java.exe) and Java Compiler (javac) versions can be checked as follows:

C:\Users\ms>java -version
java version "1.8.0_05"
Java(TM) SE Runtime Environment (build 1.8.0_05-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode)

C:\Users\ms>javac -version
javac 1.8.0_05

We can use the command java –version to find out the version of the currently installed JRE; likewise, the command javac –version tells us which version of the compiler is being used. It makes sense that both JRE and JDK are in the same version. If the following error is returned instead of a version number, we can check the path or the value of the JAVA_HOME environment variable once more.

'javac' is not recognized as an internal or external command, operable program or batch file.

2.2.2 Installation of Maven 3

One of our options is to download Maven as a ZIP file (e.g. apache-maven-3.2.1-bin.zip). We can extract the file onto the target system in a directory of our choosing, e.g. C:\Users\MS\apache-maven-3.2.1.

As we did with the Java installation, we will set up an environment variable M2_HOME, which contains the Maven installation directory as a value. We will then append %M2_HOME%\bin to the system path variable PATH. We can verify completed installations and settings using the command line. Alongside the version numbers of Maven and Java, the command mvn –version also returns the values of the environment variables M2_HOME and JAVA_HOME and information about the operating system.

C:\Users\MS\Java-EE-7-Workspace>mvn -version
Apache Maven 3.2.1 (ea8b2b07643dbb1b84b6d16e1f08391b666bc1e9; 2014-02-14T18:37:52+01:00)
Maven home: C:\Users\MS\apache-maven-3.2.1
Java version: 1.8.0_05, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.8.0_05\jre
Default locale: de_DE, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "dos"

2.2.3 Installation of WildFly 8.1.0

The WildFly application server is also available to download as a ZIP file (e.g. wildfly-8.1.0.Final.zip). We can use a ZIP tool to extract the data to a location of our choice, such as our user directory (here C:\Users\MS\). Following extraction, the target directory will contain a folder (e.g. wildfly-8.1.0.Final) in which all programs and files required by the application server are stored. We set the path to this folder in the environment variable JBOSS_HOME in the same way as we did previously for the other installed components[1]. Additionally, we will append the bin directory of the installation folder to the system path (environment variable PATH).

The application server can be run in different operating modes. The stand-alone mode is particularly suitable for development, since it starts the application server in only one process on one computer. The other mode, managed domain, allows the user to run and manage a multi-server topology. Since this mode is not best-suited for development, we will not explore that in further detail here.

We will start the server using the file standalone.bat, which is located in the bin directory of our %JBOSS_HOME% folder. To run the file, we require a new command prompt. We will start the server out of the directory %JBOSS_HOME%\standalone:

C:\Users\MS\wildfly-8.1.0.Final\standalone>standalone.bat

After running the file, a lot of output will be displayed on the command line. You can shut down the server at any time by pressing the key combination CTRL-C and then entering a “Y” to confirm.

The server logs all messages in the file %JBOSS_HOME%\standalone\log\server.log. The runtime messages are output directly on the command prompt in which the server was started. If you want to study the messages at your leisure, we recommend that you view the log file in a text editor. The file also contains the messages and stacktraces of all Java exceptions and is therefore an important aid in ascertaining errors.

We will check the installation by starting the browser and visiting the URL http://localhost:8080/.The browser should display the welcome site of the WildFly application server.

The WildFly application server also provides a web application under the port 9990, through which the server can be administered. The application can be started via the URL http://localhost:9990/. On first visit, you will be advised that a new user with administration rights must be registered in order for the application to be used. The WildFly configuration  script add-user.bat can be used to accomplish this. Since we will be running the server exclusively for development on our own computer, we can skip this step; likewise, there is no need for us to cover the use of the administration console in this book. All settings required for our project will be defined directly using the WildFly-specific configuration files – not via this web application. Nevertheless, it might still be worth taking a glance at the application, since it affords us a quick overview of the current settings and the Java EE applications that are currently deployed on the server. Take a look around when you have a spare moment!


  1. RedHat renamed the application server from JBoss to WildFly, but neglected to rename the environment variable at the same time, hence why it continues to be known as JBOSS_HOME and not WILDFLY_HOME.