How to install JBoss server in Eclipse

Installing JBoss / WildFly server in Eclipse

In this tutorial we will cover all the steps to install Eclipse IDE and, on the top of that, we will install the JBoss Tools so that we can start/stop/debug WildFly application server without leaving your IDE.
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. The Hibernate tools can be used to simplify mapping and querying your data with Hibernate. The Seam tools can be an handy guide to develop applications with JBoss AS Seam project, and so on.

We will now 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 and 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

If you are working with the supported version of JBoss products, then it’s recommended to install Red Hat Code Ready studio which will bring in your IDE all the required tools to develop applications with Red Hat middleware.

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 included:

set up jboss with eclipse

In the next screen you have to choose if the Server is locally installed (Local) or it’s a remote server (Remote) and how the Server Lifecycle is managed:

how to set up jboss in eclipse

Finally, point to the location where the application server is installed, the JRE execution environment and the configuration file to be used (default is standalone.xml) :

how to set up jboss with eclipse

Click Finish. WildFly is now configured on your Eclipse environment!

Ok, at this point you should find out in the Eclipse tool bar the following three icons:

jboss with eclipse jboss and eclipse tutorial

This icon (1) can be used to select the server version in case you have installed multiple AS version
This icon (2) can be used to boot the application server
This icon (3) can be used to 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

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 an application 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.