List icon Contents

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-8.2.0.jar – Chromium binaries for Windows 32-bit.
  • jxbrowser-win64-8.2.0.jar – Chromium binaries for Windows 64-bit.
  • jxbrowser-mac-8.2.0.jar – Chromium binaries for macOS.
  • jxbrowser-mac-arm-8.2.0.jar – Chromium binaries for macOS Apple Silicon.
  • jxbrowser-linux64-8.2.0.jar – Chromium binaries for Linux 64-bit.
  • jxbrowser-linux64-arm-8.2.0.jar – Chromium binaries for Linux ARM 64-bit.

Location

By default, JxBrowser extracts Chromium binaries to the user’s temp directory on Linux and macOS, and to AppData\Local\JxBrowser directory on Windows.

Here is how to change the directory where JxBrowser will extract the binaries:

  1. Using the jxbrowser.chromium.dir system property.

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

    Java
    Kotlin

    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:

    Java
    Kotlin

    var engine = Engine.newInstance(EngineOptions.newBuilder(renderingMode)
            .chromiumDir(Paths.get("Users/Me/.jxbrowser"))
            .build());
    

    val engine = Engine(renderingMode) {
        chromiumDir = Path("Users/Me/.jxbrowser")
    }
    

The directory path can be either relative or absolute.

The directory cannot be located on a network drive.

Verification

Each JxBrowser version is compatible only with the same version of the binaries. For example, JxBrowser 8.2.0.1 will not work with the binaries from JxBrowser 8.2.0.

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

Extraction

By default, JxBrowser extracts binaries from a corresponding JAR file when Engine is first created. If you need to extract binaries earlier, use this code:

Java
Kotlin

// Use the default directory.
ChromiumBinaries.deliverToDefaultDirectory();
// Or use an arbitrary directory.
ChromiumBinaries.deliverTo(Paths.get("/path/to/binaries"));

// Use the default directory.
ChromiumBinaries.deliverToDefaultDirectory()
// Or use an arbitrary directory.
ChromiumBinaries.deliverTo(Path("/path/to/binaries"))

If the compatible binaries are already extracted, JxBrowser will not extract them again. Otherwise, JxBrowser will extract the binaries again and override the existing files.

Custom delivery

Starting with JxBrowser 7.35, developers can get the full control of delivering Chromium binaries to the environment. This capability is intended for advanced use cases, such as downloading binaries from the network, or using a custom compression algorithm.

To customize the delivery, implement BinariesDelivery interface and deliver the binaries when you need them:

Java
Kotlin

class TuneBinaryDelivery implements BinariesDelivery {

    public void deliverTo(Path chromiumDir) {
        // Pseudocode:
        // Path downloadedArchive = SharedNetworkDrive.download("jxbrowser-win64.gz");
        // Gzip.extract(downloadedArchive, chromiumDir);
    }
}
...
// Use the default directory.
ChromiumBinaries.deliverToDefaultDirectory(new TuneBinaryDelivery());

// Or use an arbitrary directory.
ChromiumBinaries.deliverTo(chromiumDir, new TuneBinaryDelivery());

class TuneBinaryDelivery : BinariesDelivery {
    override fun deliverTo(chromiumDir: Path) {
        // Pseudocode:
        // Path downloadedArchive = SharedNetworkDrive.download("jxbrowser-win64.gz");
        // Gzip.extract(downloadedArchive, chromiumDir);
    }
}
...
// Use the default directory.
ChromiumBinaries.deliverToDefaultDirectory(TuneBinaryDelivery())

// Or use an arbitrary directory.
ChromiumBinaries.deliverTo(chromiumDir, TuneBinaryDelivery())

If the compatible binaries are already extracted, JxBrowser will not call the custom delivery.

Sandbox

Windows

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

Java
Kotlin

var engine = Engine.newInstance(EngineOptions.newBuilder(renderingMode)
        .disableSandbox()
        .build());

val engine = Engine(renderingMode) {
    sandboxDisabled = true
}

Linux and macOS

Currently, Sandbox is supported on Windows platform only.

Traffic

Chromium is a complex software that consists of many components. Some components may perform background network activity for various purposes like sending statistic data, synchronization, optimization, data download, etc.

In this section we describe the components that might generate additional network traffic and explain how to disable them.

Optimization Guide Service

This component represents a Chromium service from Google. It’s designed to help developers improve the app performance and efficiency. It provides tailored optimization advice and runtime configuration data based on a device’s specific hardware, software, and user habits. This service is especially essential when developing apps for Android. When started this service fetches the optimization models from a Google web service.

JxBrowser disables this component, so it doesn’t fetch any data from the Google web service.

Spell checker

By default, this component doesn’t send any requests to external web servers. It uses the local dictionaries to check the spelling. However, it may send requests to the Google web service to fetch the dictionaries for the languages that are not available locally.

If you don’t need the spell checker functionality, and you want to suppress any network activity related to it, you can disable the spell checker using the approach described in the Spell Checker guide.

Translate Ranker

This component is used to determine whether a user should be given a translation prompt or not. Chromium downloads the ranker models required for language determination.

This component is disabled in JxBrowser, so it doesn’t fetch any data from external web servers.

Media casting

This component is responsible for media content casting to the media devices with Chromecast. When Chromium is started this component sends a multicast request in the local network to discover the devices available for casting.

By default, the Chromecast feature is disabled and no traffic is generated. The Chromecast feature can be enabled when initializing an Engine instance as described in the Media guide.

Component Updater

This component is responsible for updating other components in Chromium. By default, it’s disabled. If you enable proprietary codecs, the component updater will be enabled automatically to update the corresponding internal components. When this component is enabled, you might see requests to https://update.googleapis.com/service/update2/json.

DNS Over HTTPS (DoH)

DoH is the default DNS resolution protocol used in Chromium. Chromium checks whether the system DNS provider supports DoH and tries to recognize it. If the system DNS is configured to use Google Public DNS or another recognized provider that supports DoH, Chromium will automatically switch to that provider’s DoH service. Thus, Chromium will make requests to the trusted DoH servers such as google.dns to resolve DNS.

By default, DoH is enabled in JxBrowser. If you want to disable it, use the following code:

Java

var engine = Engine.newInstance(EngineOptions.newBuilder(renderingMode)
        .disableDnsOverHttps()
        .build());

When DoH is disabled, Chromium will use the unencrypted system DNS over UDP or TCP as configured by the operating system for DNS resolution