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.
These are the basic steps that will be taken to set up the Windows Service.
Step 1: Copy Files to Wildfly Directory
Step 2: Update the Service Batch File Settings
Step 3: Install the Service
Step 4: Update the Windows Service Properties
Step 5: Verify Wildfly Service Started
1. Go to YOUR_WILDFILY_HOME_DIR\docs/contrib/scripts.
2. Copy the service folder to C:\opt\wildfly-17.0.0.Final\bin
One of the files in the service folder you copied to your Wildfly directory was service.bat.
1. Go to YOUR_WILDFILY_HOME_DIR\bin\service
2. Locate the service.bat file and open it in Edit Mode.
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
The SHORTNAME needs to be unique
4. To prevent memory loss issues you need to modify the JAVA_OPTS setting to increase the memory.
The third step in this process is to install the service.
1. Open the Windows Command Prompt as an Administrator.
2. Enter the following command to change your directory to the bin directory in your WILDFLY directory.
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
3. Enter the following command to install the service.
4. Provided there are no errors the service will be installed.
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.
1. Go to your Administrative Tools directory
a. Click on Start and select Control Panel.
b. In the Control Panel click on System and Security.
c. Click on Administrative Tools
2. Double click on Services to display a list of local services installed on your server.
3. Scroll to the service called Wildfly Application Server.
The actual name that appears in the list of services depends on what you entered in the service.bat file for the DISPLAYNAME setting.
4. Using the mouse, right click on the name of the service to display the pop-up menu.
5. Select Properties to open the Properties Window.
6. At Startup Type select Automatic from the drop-down list.
7. Click on Start to start the Wildfly services.
8. A dialog window will open displaying the progress of starting the service.
9. Once the startup process is complete click on OK to save the changes.
The fifth and final step is to verify the Windows service started your Wildfly server.
1. Open a web browser and enter the following address:
2. The Wildfly Welcome page will display if your Wildfly server started correctly.