May 24, 2016 | Written by: Bobby Woolf
Categorized: Compute Services | How-tos
Share this post:
WebSphere Liberty is the next generation application server. Liberty and Eclipse make a great local development environment for developing Java EE applications. To develop Java EE applications to deploy to Liberty, you’re going to need a Liberty development environment. You’ll also need an integrated development environment (IDE) for editing your code. While any Java EE IDE will work, the Eclipse IDE is one of the best, if for no other reason than because IBM has developed plugins for Eclipse for developing Liberty applications and for working with Bluemix.
In this excerpt from “Java EE, the next inception: Install a local Java EE development environment for WebSphere Liberty,” we’ll see how to install a Java EE development environment using Liberty and Eclipse.
Next, we’ll discuss common development tasks and how to perform them in this environment, starting with creating a Liberty server using Eclipse.
To start at the beginning of this series, see WebSphere Liberty: Developing Java EE applications for the cloud.
Install the development environment
To develop Java applications for Liberty, it’s helpful to have a local development environment consisting not only of the Liberty runtime environment, but also the Eclipse development tools. This section shows how to install and configure a development environment consisting of Eclipse and Liberty.
To install Liberty and Eclipse, you will:
These steps are explained in detail below.
1. Set up installation directories
The first question is where should you install Eclipse and Liberty? The Java runtime (JRE, JDK, or SDK) is an executable and the Eclipse IDE installs like an executable, so they are typically installed in the computer’s default directory for applications or program files. But Eclipse requires a workspace directory, and Liberty requires an installation directory. Where should these directories go?
Pretty much any set of directories will work. Table 1 shows a set of directories that work well. (You should name the directory after the version of Liberty that you’re installing. Therefore, the
wlp directory name used here assumes you’re installing v22.214.171.124.)
Table 1. Sample installation directory structure
|All development artifacts
|Server product installs
|Liberty profile v126.96.36.199
|Default Eclipse workspace
|Projects from Git
Whatever directory structure you choose, this installation process will need these two directories:
<Liberty_Root> – Where you install LibertyFor example:
<Eclipse_Workspace> – Where you create Eclipse’s workspaceFor example:
2. Install a JDK
Liberty requires a separately installed JRE, and Eclipse requires a JDK. Since a JDK includes a JRE, you will install a JDK. These resources can provide help:
You have now installed a JDK that will be used by Liberty and Eclipse.
3. Install Liberty profile
To run and test your applications locally, you’ll need a local Liberty profile and server. Remember that this procedure does not install the full WebSphere Application Server product (which includes the Full profile and Liberty profile). Rather, you will install a Liberty developer build, which includes the Liberty profile only. It’s a small download that is quick to install:
Store the download file somewhere convenient so that you can reinstall it whenever you need to.
To install the Liberty download, simply unpack the archive. Put the resulting
wlp directory somewhere convenient such as
<Liberty_Root>. In the Java EE 7 build of Liberty, the feature manager is configured by default to enable the javaee-7.0 feature.
The Liberty documentation is available in Liberty profile overview in WebSphere Application Server (Distributed and IBM i operating systems), Version 8.5.5.
The Liberty profile is now installed in
4. Install Eclipse
To develop Java applications for Liberty, it’s helpful to have an integrated development environment (IDE). There are several available and you can use the one you prefer. This tutorial uses Eclipse because it’s free and because this tutorial uses some helpful Java development toolkits from IBM that run in Eclipse.
Install the Eclipse IDE for Java EE Developers:
- The latest version (code named Mars, as if this writing) is available from Eclipse Downloads.
- Install this package: Eclipse IDE for Java EE Developers.
- It’s easiest to use the Eclipse Installer. Otherwise, download and install an Eclipse Package by following the Eclipse/Installation directions.
Eclipse with the Java development tools is now installed so you can run it.
To run Eclipse, see Running Eclipse in Eclipse documentation – Current Release.
You now have Eclipse installed and running.
5. Install the WebSphere Developer Tools
The WebSphere Developer Tools make it easier to use Eclipse to deploy applications to WebSphere Application Server, including the Liberty profile.
You can also use the Install button for WAS Liberty Profile V8.5.5 to download and install the tools. Drag it from the web page and drop it on the Eclipse window.
The documentation is available from IBM WebSphere Developer Tools, Version 8.5.
The WebSphere Developer Tools are now installed in Eclipse.
6. Install Liberty Server in Eclipse
With a local Liberty profile installed, you’ll need a Liberty server, and you’ll need to link to it in Eclipse so that you can use it in Eclipse.
Create a Liberty server by creating these elements (the names shown here are for Liberty v188.8.131.52):
- Runtime environment in Eclipse – Named
wlp-184.108.40.206, with the path
- Server in the Liberty profile – Named
- Server in Eclipse – Named
wlp-220.127.116.11 defaultServer at localhost.
Experienced users can perform all of this in the New Server dialog. For a more step-by-step process, see below.
You now have a Liberty server created and accessible from Eclipse.
At this point, you have installed Liberty and Eclipse, and connected them together so that you can use Eclipse to deploy applications to Liberty. The next section explains common tasks for using Eclipse with Liberty.
—Bobby Woolf (@bobby_woolf)