This guide describes how to work with the Chromium build used by JxBrowser.

You do not need to install Chromium or Google Chrome on the target environment to use JxBrowser. JxBrowser uses and deploys its own Chromium build.

Binaries

Chromium binaries for each supported platform are located inside correspondent JxBrowser JARs:

  • jxbrowser-win32-7.0.jar – Chromium binaries for Windows 32-bit.
  • jxbrowser-win64-7.0.jar – Chromium binaries for Windows 64-bit.
  • jxbrowser-mac-7.0.jar – Chromium binaries for macOS.
  • jxbrowser-linux64-7.0.jar – Chromium binaries for Linux 64-bit.

To use Chromium you will need to extract its binaries.

Extraction

JxBrowser extracts the Chromium binaries for the target platform from the correspondent JAR during the first start.

On macOS and Linux the binaries are extracted into the user’s temp directory.

On Windows they are placed in the AppData\Local\JxBrowser directory.

JxBrowser checks whether the directory contains the required Chromium files. If none are found, it extracts the binaries from the JAR files included in the application class path.

You can customize the default path to the directory, where the binaries should be extracted, or extract the binaries manually and tell the library where they are located.

Location

Here is how to specify the directory path where the Chromium binaries are extracted:

  1. Using the jxbrowser.chromium.dir System Property.

    It can be done either by System.setProperty() method:

     System.setProperty("jxbrowser.chromium.dir", "Users/Me/.jxbrowser");
    

    or through a JVM parameter:

     -Djxbrowser.chromium.dir="Users/Me/.jxbrowser"
    
  2. Via the EngineOptions when constructing the Engine:

     Engine engine = Engine.newInstance(EngineOptions.newBuilder()
             .setChromiumDir("Users/Me/.jxbrowser")
             ...
             .build());
    

The directory path can be either relative or absolute.

If the directory already has the required Chromium binaries, the library will not perform the extraction.

If the directory is corrupted and some Chromium files are missing, JxBrowser will extract the binaries and override the existing files.

Verification

Each JxBrowser version is only compatible with the Chromium binaries deployed with this version. The Chromium binaries of JxBrowser 7.0 will not work with other JxBrowser versions e.g. 7.0.1.

To make sure that the Chromium binaries are compatible with the current JxBrowser version, the library verifies the binaries.

Switches

Chromium accepts the command line switches that change the behavior of the features, allow to debug, or turn the experimental features on.

For the list of switches and their description please see the documentation provided by Peter Beverloo.

Not all the Chromium switches are supported by JxBrowser. Therefore, we recommend configuring Chromium through the Engine Options instead of switches.

Sandbox

Windows

JxBrowser supports Chromium Sandbox on Windows. Sandbox is enabled by default, but you can disable it via the appropriate Engine option:

Engine engine = Engine.newInstance(EngineOptions.newBuilder()
        .setNoSandbox(true)
        ...
        .build());

Linux and macOS

Currently Sandbox is supported on Windows platform only.

Chrome Extensions

JxBrowser does not support the extensions designed to be used in the Chrome application.

The library integrates only with the web browser control that renders the web content. Thus it does not have the Chrome GUI, with elements like tool bar and context menu, required to integrate the extensions.

Go Top