Check JBoss Version Command Line Linux – Quick & Easy Guide
For developers and system administrators managing enterprise Java applications, knowing the exact runtime environment is critical. When dealing with Java applications, JBoss Application Server (or its successor, WildFly) is often the backbone of the infrastructure. Identifying the specific version running on a Linux server is not just about curiosity; it is essential for security patching, compatibility checks, and troubleshooting.
The command line provides the most direct and reliable method to interact with the JBoss runtime. Unlike graphical interfaces or management consoles, the terminal offers a scriptable and immediate way to query the server. This guide focuses on the specific commands and file locations required to determine the JBoss version on a Linux system, ensuring you can perform these checks efficiently from the shell.
Understanding the JBoss Runtime Structure
Before diving into commands, it is helpful to understand how JBoss organizes its version information. The version details are not usually stored in a single dynamic file but are embedded within static configuration files and shell scripts during the build process. The primary location for this data is the `module.xml` file, which acts as a manifest for the core application server modules. By reading this file, you bypass the need to start the entire server, saving time and resources.
Direct File Inspection Method
The most universally applicable method, especially when the server is not currently running, involves inspecting the file system directly. You will be looking at the `module.xml` file located within the core JBoss modules directory. This file contains the `version` attribute that explicitly states the build number of the application server.
Here is the command sequence to perform this check:
- First, navigate to the directory containing the module definition. The standard path for the main server module is:
cd /path/to/jboss/modules/system/layers/base/org/jboss/as/server/main/
- Once there, use
greporcatto extract the version string:
grep 'version' module.xml
This command will output a line similar to <module name="org.jboss.as.server" slot="main" version="24.0.1.Final"/>, where the version number indicates the specific build of JBoss/WildFly you are running.
Utilizing the CLI Script
If the JBoss process is actively running, the Command Line Interface (CLI) script offers a dynamic way to interrogate the runtime. This method connects to the live management interface and retrieves the server's state, including the version. It is the preferred method for production environments where you need real-time data without logging in to the management console.
To use this approach, you need to locate the `jboss-cli.sh` script. It is usually found in the `bin` directory of your JBoss installation. Assuming your `JBOSS_HOME` is set to `/opt/jboss`, the command is as follows:
$JBOSS_HOME/bin/jboss-cli.sh --command=":read-attribute(name=product-version)"
Executing this command will return a response similar to { "outcome" => "success", "result" => "26.1.2.Final" }. This result represents the exact version of the running instance, which is particularly useful for verifying hotfixes or patches applied at runtime.
Checking the Main Build File
Another reliable approach involves checking the `build.xml` file, which is the Ant build script used historically to compile JBoss. While this file is not present in all distributions—especially newer WildFly versions—it remains a valid source of truth in many legacy installations. The version is usually stored as a property at the top of the file, making it easy to identify.
Run the following command from the root of your JBoss installation directory:
grep 'jboss.build.version' build.xml | head -1
This will return a line such as `
Cross-Referencing Environment Variables
Sometimes, the version information is abstracted through environment variables or wrapper scripts. For instance, the `JBOSS_HOME` environment variable indicates the installation root, but the specific version string might be sourced from a profile or a custom launcher script. To confirm the path your shell is using, utilize the `which` or `type` command.
Running `which jboss` or `type jboss` will reveal if `jboss` is an alias or a symlink to a specific versioned directory. If it resolves to a path like `/opt/jboss-eap-7.4/bin/jboss`, the version is often embedded in the directory name itself (e.g., `eap-7.4`). This initial check helps ensure you are inspecting the correct installation when multiple versions exist on the same host.
Verifying the Manifest in the Client Jar
For a more granular check that verifies the client libraries, you can inspect the `jboss-client.jar` file. Every JBoss distribution includes this JAR, which contains a `META-INF/MANIFEST.MF` file. This manifest holds metadata about the build, including the version number. You can query this manifest directly from the terminal using the `unzip` command with the `-p` flag to pipe the output to `grep`, avoiding the need to extract the file physically.
unzip -p jboss-client.jar META-INF/MANIFEST.MF | grep Implementation-Version
If the JAR is available in your current directory or path, this command will return `Implementation-Version: 7.4.11.GA` or a similar string. This technique is excellent for verifying the exact version of the libraries your application is linking against, ensuring that your development environment matches your production deployment.