JxBrowser library can be used in the headless Linux environments. To achieve that, the X-Server must be started.

In order to start X-Server, you need to perform the following actions:

1. Install Xvfb server in your headless Linux (e.g. Ubuntu Server 16.04.2 LTS):

sudo apt-get install xvfb

2. Start X-Server using the following command:

Xvfb :1 -screen 0 800x600x16

3. Run your Java application, e.g. packed in the jar file, using the xvfb-run command:

xvfb-run java -jar yourApplication.jar

What about the --headless command line flag?

Chromium 58 and higher supports the --headless command line flag (Linux-only) that allows you to run Chromium in Linux headless environment without starting X-Server. This flag is designed for the case when you just need to run Chromium in headless environment, load some URL, and attach to the loaded web page using DevTools via the --remote-debugging-port switcher. For example:

$ chrome --headless --remote-debugging-port=9222 https://chromium.org

Then, you load the localhost:9222 web page in a web browser application and work with the loaded web page using DevTools.

As you can see, the --headless command line flag is designed to be used when you need to load a single web page and work with it via DevTools. We checked Chromium's source code and figured out that this flag forces Chromium to use a separate, limited version the Chromium API that doesn't support ~80-90% of the features used in JxBrowser. It means that this flag disables ~80-90% of JxBrowser functionality such as loading different web pages by URL, HTML, navigating backward, forward, executing JavaScript, etc. This is why this flag isn't supported by JxBrowser and we recommend that you start X-Server to use JxBrowser in a headless Linux environment.