How to install JBoss server in Eclipse

In this tutorial we will cover all the steps to install Eclipse IDE. On the top of that, we will install the JBoss Tools so that we can start/stop/debug WildFly application server without leaving Eclipse.


First of all, let’s get to the Eclipse main download page which is at: https://www.eclipse.org/downloads/packages/
As you can see, there are multiple solutions for developing applications. The latest version of Eclipse, requires a simple installation on your machine. If you are interested in developing Enterprise application using an Eclipse Cloud Solution, then take a look at Eclipse Che: Develop your Enterprise applications on the Cloud with Eclipse Che

In this tutorial we will show how to use the latest version of Eclipse to get started with developing applications on JBoss EAP / WildFly and Eclipse.

Step 1: Install Eclipse

The first step is to download the Eclipse installer from: https://www.eclipse.org/downloads/

Run the eclipse installer:

$ eclipse-inst

Then, choose the version of Eclpse to install:

how to set up jboss server in eclipse

The “Eclipse IDE for Java Developers” will install a minimal version of the IDE for developing Java applications with Maven/Gradle integration. If you want some extra tooling for developing applications, such as JPA and Data Tooling, choose the “Eclipse IDE for Enterprise Java Developers”.

Once down with the download, launch eclipse.

Step 2: Install JBoss Tools

JBoss tools is a set of subprojects which are related to JBoss products: for example you can use JBoss AS Tools to create, deploy and debug applications on JBoss AS. For example, you can use the Hibernate tools to simplify mapping and querying your data with Hibernate.

Firstly, we will show how to install JBoss AS Tools on Eclipse. There are several ways to install Eclipse plugins: basically this boils down to intalling the plugin from within Eclipse environment and downloading and manually installing the tools. The simplest way to do it is through the Help | Eclipse Market Place:

From there, enter in the search box “jboss tools“. You will see several JBoss Tools releases available. Choose to install or update the latest stable JBoss Tools plugin:

wildfly eclipse jboss tools

In the next screen select the “JBoss AS tools” plugin and restart Eclipse once completed. Now choose from the upper Menu: File | New | Server and expand the JBoss Community option. A set of “WildFly” Servers are now available:

set up jboss with eclipse

Next, choose if the Server is locally installed (Local) or it’s a remote server (Remote) and how to control the Server lifecycle:

how to set up jboss in eclipse

Finally, specify the following settings:

  1. WildFly Home directory
  2. Location of Runtime JRE
  3. Server base directory and Configuration file

Example:

how to set up jboss with eclipse

Click Finish. You have now configured WildFly on your Eclipse environment!

Useful Icons and Views

To manage the application server with ease, get familiar with the following icons in the Eclipse tool bar:

jboss with eclipse jboss and eclipse tutorial

(1) Select the server version – in case you have installed multiple AS version
(2) Start the application server
(3) Debug the application server

Additionally, you can choose from the Menu: Window | Show View | Server
The following tab GUI will be accessible to start/stop/debug and deploy applications on JBoss AS.
jboss eclipse tutorial wildfly

Finally, let’s try to start the server. Right click on the Server icon and choose “Start” from the Menu.
The Console Tab GUI will activate, showing the server boot logs. At the end of the process, the Console will display f the server started correctly.
jboss eclipse tutorial wildfly


Deploying applications to JBoss AS / WildFly with Eclipse

Deploying an application is quite easy and just requires right clicking on the Server icon and choosing “Add and Remove“. In the next GUI choose a Java EE application project which will be deployed to JBoss AS and click on “Add” and “Finish“.
jboss with eclipse jboss and eclipse tutorial

Fine. In a few seconds your application will be available on JBoss AS.

How to debug your applications running on JBoss AS / WildFly.

The simplest way to debug your Java EE applications on JBoss AS / WildFly is starting the server from within Eclipse in Debug mode. Simply right click on the Server icon and choose “Debug“. Once that the compiled code hits a breakpoint, the Debug perspective view will kick in.

The other way to debug, is called remote debugging and happens if you are running JBoss AS on a separate process. In order to remotely debug JBoss AS, set this properties in the AS start script (standalone.conf):

JAVA_OPTS="$JAVA_OPTS -agentlib:jdwp=transport=dt_socket,address=8787,server=y,suspend=n"

In the Debug configuration, create a new Remote Java Application node.
In the Connection Properties, specify localhost as the Host and specify the Port as the port that was specified in the run batch script of the JBoss server, 8787.

jboss with eclipse jboss and eclipse tutorial

Please note that WildFly and JBoss EAP use deployment marker files to trigger deployment of applications. By default packaged archives are automatically deployed. On the other hand, exploded archives require a marker file named application.dodeploy to trigger deployment: for example if you are deploying an explodec application named Example.war, then you need creating a file Example.war.dodeploy in the deployments folder.