How to Deploy a Java Application with Wildfly Application Server – The New Stack

Wildfly is a modular, lightweight Java application server managed by Red Hat that can be deployed for free in your data center or on a third-party cloud host. We’ve covered deploying Wildfly on an Ubuntu Server 20.04 instance and now we’ll take it a step further and see how easy it is to deploy a Java application with the platform.

For this to work, you will need the following:

  • A running instance of Wildfly
  • A sample Java application to deploy

Before demonstrating the actual deployment, we need to create a deployable Java application. For this, we will turn to the Hello, World!

Install the Java JDK

To create the Java application, we’re going to need a little help from the Java JDK. Since we are demonstrating on Ubuntu, installing the Java JDK is quite simple. Log in to your Ubuntu machine, open a terminal window and run the command:

sudo apt-get install default-jdk -y

The installation will take care of all necessary dependencies. Once complete, you can verify the installation with:

java --version

You should see something like the following in the output:

Build a Java Application

Next, we’ll create a simple Java application. With Wildfly, you can deploy file types such as EJB-JAR, WAR, EAR, or any standard archive type (like RAR). We will create a WAR archive for our Java deployment.

To do this, create a new directory with the command:


Navigate to this newly created directory with the command:


In this directory, create two other directories with the commands:

Next, create the index.jsp file with the command:

nano index.jsp

In this file, paste the following content:

JSP testing

Channel Title = “Hello World”;

If you see this, the sample war file was correctly from >

You are from

Save and close the file.

Then create the MANIFEST.MF file with the command:


In this file, paste the following:

Where NAME is your name.

Save and close this file.

Create the web.xml file with the command:

nano WEB-INF/web.xml

Paste the following content into this file:

Save and close the file. If we issue the tree command, we will see that the structure of your Java application looks like this:

├── index.jsp
└── web.xml

With everything in place, we can now create a .war file with the command:

jar -cvf helloworld.war *

The options are:

After the command completes, you will find the helloworld.war file in the directory.

Deploy the new Java application

Now is the time to roll out our Hello, World! Java app. Log in to your instance of Wildfly and from the main page click Start (under Deployments — Figure 1).

Figure 1

Access the deployment tool in the Wildfly web interface.

On the resulting page, drag the helloworld.war file into the Deployment pane on the left side (Figure 2).

Figure 2

The deployment window allows easy drag-and-drop addition of supported files.

Once the file is uploaded, it will be listed in the Deployment pane (picture 3).

picture 3

Our helloworld.war file has been successfully deployed to Wildfly.

Click on the helloworld.war entry to display the application attributes (Figure 4).

Figure 4

Details of our helloworld.war application as seen by Wildfly.

In the details, you should see a link for the app root, listed as /helloworld. If you click this link, it should take you to the running application (Figure 5).

Figure 5

Running the Hello, World! the app kindly reminds us that it works as expected.

You can deploy as many apps as you want and they can then be accessed from the server via a web browser and an address such as http://SERVER:8080/APP/ (where SERVER is either the IP address or the DOMAIN of the hosting server and APP is the name of the application. In our case, the URL of the application would be:

Anyone on your local network should be able to access this application.

If you want to disable your deployed app, click the drop-down menu next to View and select Disable (Figure 6).

Figure 6

Disabling our Hello, World application from Wildfly.

You can also undeploy an app by selecting Undeploy from the same drop-down list.


Wildfly is a very powerful and simple to use Java application server. If you’re looking to deploy a Java-based application to your LAN, WAN, or from a third-party cloud host, this is a great place to start.

The New Stack is a wholly owned subsidiary of Insight Partners, an investor in the following companies mentioned in this article: Bit.

You might also like More from author

Comments are closed.