Setting up a Windows service to run your Wildfly Web Server will allow the server to continuously run in the background, without any user interaction. Another advantage of a Windows service is that it will run no matter which user is logged onto the machine. This means you do not have to leave a user logged onto the server just to keep Wildfly running. You can also configure the service to start automatically if the system is rebooted.
The information in this section will guide you through setting up Wildfly 10 to run as a Windows Service.
Overview of Steps
These are the basic steps that will be taken to set up the Windows Service.
Step 1: Copy Files to Wildfly Directory
Steps to Copy Files
Step 2: Update the Settings in the Service Batch File
One of the files in the service folder you copied to your Wildfly directory was service.bat.
Steps to Modify service.bat
If you are installing multiple servers you may want to update these settings with something that is more meaningful. The DISLAYNAME will appear in your Windows Services list so if you are installing multiple servers on the same windows machine you may want to update these settings with something that is more meaningful.
Example: If you have a development and production environment you may want to update the settings to one of the following.
DISPLAYNAME=Wildfly Application Server 17.0.0.Final Development
DISPLAYNAME=Wildfly Application Server 17.0.0.Final Production
The SHORTNAME needs to be unique
JAVAOPTS=-Xmx1024M -Xms512M -XX:MaxPermSize=512M -Xrs
Step 3: Install the Service
The third step in this process is to install the service.
If you have set your JBOSS_HOME system variable you can replace the Wildfly directory path with %JBOSS_HOME%.
Example: CD %JBOSS_HOME%\bin\service
Step 4: Update the Windows Service Properties
The fourth step is to update the properties of the service you just installed. During this step we will set the JBoss service to start automatically and we will start the service to make sure it was installed correctly.
Steps to Update Properties
The actual name that appears in the list of services depends on what you entered in the service.bat file for the DISPLAYNAME setting.
Step 5: Verify Wildfly Server Started
The fifth and final step is to verify the Windows service started your Wildfly server.