Chromium

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.32.jar – Chromium binaries for Windows 32-bit.
  • jxbrowser-win64-7.32.jar – Chromium binaries for Windows 64-bit.
  • jxbrowser-mac-7.32.jar – Chromium binaries for macOS.
  • jxbrowser-mac-arm-7.32.jar – Chromium binaries for macOS ARM (M1).
  • jxbrowser-linux64-7.32.jar – Chromium binaries for Linux 64-bit.
  • jxbrowser-linux64-arm-7.32.jar – Chromium binaries for Linux ARM 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");
    
     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(...)
             .chromiumDir("Users/Me/.jxbrowser")
             .build());
    
     val engine = Engine.newInstance(EngineOptions.newBuilder(...)
             .chromiumDir("Users/Me/.jxbrowser")
             .build())
    

The directory path can be either relative or absolute.

The directory cannot be located on a network drive.

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.32 will not work with other JxBrowser versions e.g. 7.32.1.

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

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(...)
        .disableSandbox()
        .build());
val engine = Engine.newInstance(EngineOptions.newBuilder(...)
        .disableSandbox()
        .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 toolbar and context menu, required to integrate the extensions.

Go Top