JxBrowser and JavaFX WebView

Both JxBrowser and JavaFX WebView allow you to bring web technologies in your cross-platform Java desktop application to get the best of both worlds: the ubiquity of the web platform and the power of the Java platform.

Before choosing JxBrowser our clients sometimes ask us about the difference between JxBrowser and JavaFX WebView. In this article we will compare these solutions in terms of their architecture, rendering, support of the latest web standards including HTML5, CSS3, JavaScript, and more.


JavaFX WebView was introduced in JavaFX 2.0 that became a part of JDK 8 in 2014. If you use Java 8, then you don’t need to do anything special to start using JavaFX WebView. With JDK 11 and higher JavaFX is no longer bundled, so to develop using JavaFX 11 or higher you must download it separately.

JxBrowser is a third-party library that you need to add to your project as a dependency. You can simply download and add it to your application classpath, or quickly add it to your Gradle or Maven project.


JavaFX WebView uses WebKit internally. JxBrowser uses a fully-functional Chromium underhood. Both solutions include all the necessary engine binaries and do not require the end users to install Chromium or Safari.


WebKit does not render web pages, so JavaFX developers had to implement a separate lightweight (off-screen) renderer. JavaFX 17 WebView renders web pages well, so there won’t be any visible differences compared with Safari, Mozilla Firefox, or Google Chrome.

In JxBrowser the web pages are rendered by Chromium using GPU. So they look exactly as in Google Chrome. JxBrowser supports two rendering modes: off-screen and hardware accelerated.


JavaFX initializes and runs WebKit in your Java process. The advantage of this approach is that JavaFX allows you to create and display WebView very quickly compared to JxBrowser, where an external Chromium process must be launched first. However, to obtain such a speed WebKit allocates and uses memory and CPU of your Java process. Some modern web pages might allocate more than 1GB of RAM. The more WebView instances you create and load web pages, the more RAM of your Java application will be taken.

JavaFX WebView Architecture

JxBrowser runs Chromium in a separate native process and communicates with it via the Inter-Process Communication (IPC) bridge. With this solution, Chromium does not affect the memory usage of your Java application. Moreover JxBrowser supports Chromium multi-process architecture. If a web page or JavaScript crashes for some reason, Chromium will continue working and you can even restore the crashed web page.

JxBrowser Architecture


WebKit is written using C++. To call WebKit functionality, JavaFX WebView uses JNI. Since WebKit is running inside JVM, any error or unexpected behavior might cause a JVM crash and terminate your Java application unexpectedly. The end user’s data might be lost or corrupted.

In case of an error in Chromium, your Java program will continue running. JxBrowser even provides an API to inform you about unexpected Chromium termination or crash in a Chromium process, so you can re-initialize and restore a user session for better user experience.

Web Standards

If you load http://html5test.com in JavaFX 17 WebView and JxBrowser 7.20 (Chromium 94) you will get the following results:

JavaFX WebView and JxBrowser HTML5 Scores

Different JavaFX versions support different web standards. For example, JavaFX 8 does not play video on YouTube at all:

JavaFX WebView 8 YouTube

And renders Google with some artifacts:

JavaFX WebView 8 Google

JavaFX 17 works well for the same tasks:

JavaFX WebView 17 YouTube JavaFX WebView 17 Google

WebGL is not supported by JavaFX.

JavaFX WebView vs JxBrowser WebGL

Google Maps are not displayed properly even in JavaFX 17:

JavaFX WebView 17 Google Maps

Supported UI-Toolkits

JavaFX WebView can be seamlessly used for JavaFX applications. If you develop your app using Java Swing or SWT, then you can embed JavaFX WebView via JFXPanel and FXCanvas.

JxBrowser supports all Java UI-toolkits including JavaFX, Swing, and SWT. It provides the following components for embedding:

  • com.teamdev.jxbrowser.view.swing.BrowserView
  • com.teamdev.jxbrowser.view.javafx.BrowserView
  • com.teamdev.jxbrowser.view.swt.BrowserView


The efforts required to write a simple JavaFX app with an address bar and web view that renders the currently loaded web page are pretty similar.

JavaFX WebView

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.TextField;
import javafx.scene.layout.BorderPane;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebView;
import javafx.stage.Stage;

public final class Main extends Application {

    public void start(Stage primaryStage) {
        WebView view = new WebView();
        WebEngine engine = view.getEngine();

        BorderPane root = new BorderPane(view);

        TextField addressBar = new TextField("https://google.com");
        addressBar.setOnAction(event -> engine.load(addressBar.getText()));

        // Update address bar with URL of the currently loaded web page.
        engine.locationProperty().addListener((observable, oldValue, newValue) ->

        primaryStage.setTitle("JavaFX WebView");
        primaryStage.setScene(new Scene(root, 1000, 600));



import static com.teamdev.jxbrowser.engine.RenderingMode.HARDWARE_ACCELERATED;

import com.teamdev.jxbrowser.browser.Browser;
import com.teamdev.jxbrowser.engine.Engine;
import com.teamdev.jxbrowser.navigation.event.NavigationFinished;
import com.teamdev.jxbrowser.view.javafx.BrowserView;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.TextField;
import javafx.scene.layout.BorderPane;
import javafx.stage.Stage;

public final class SmokeTest extends Application {

    public void start(Stage primaryStage) {
        Engine engine = Engine.newInstance(HARDWARE_ACCELERATED);
        Browser browser = engine.newBrowser();
        BrowserView view = BrowserView.newInstance(browser);

        BorderPane root = new BorderPane(view);

        TextField addressBar = new TextField("https://google.com");
        addressBar.setOnAction(event -> browser.navigation().loadUrl(addressBar.getText()));

        // Update address bar with URL of the currently loaded web page.
        browser.navigation().on(NavigationFinished.class, event -> {
            if (event.isInMainFrame()) {

        primaryStage.setScene(new Scene(root, 1000, 600));


        // Close the engine when stage is about to close.
        primaryStage.setOnCloseRequest(event -> engine.close());

API and Features

JavaFX WebView API: ~1 package, ~10 classes & interfaces. JavaFX WebView represents a simple web browser control. There were no goals to provide functionality of a fully-functional web browser such as network, SSL, authentication, cookies, DevTools, plugins, PDF Viewer, etc. The API provides the basic web browser functionality that allows loading a web page, getting various load events, access and modify DOM, execute JavaScript, call Java from JavaScript by injecting Java objects into JavaScript, handle popups and display JavaScript dialogs such as alert, confirm, prompt.

JxBrowser API: ~60 packages, ~580 classes & interfaces. JxBrowser wraps and uses a fully-functional web browser app underhood. The API provides access to hundreds of the Chromium features such as managing profiles including incognito, plugins, proxy, cookies, spell checking, downloads, permissions, authentication (proxy, basic, digest, NTLM, SSL client certificates, SuisseID, U2F, Integrated Windows Authentication and Kerberos), passwords, zoom, printing, DevTools, network, custom protocols and more.

Support and Updates

JavaFX is an open source project. If you see a bug or there is a missing feature, you can contribute. JavaFX follows OpenJDKs 6-months release cycle. A new version is released every 6 months. It is still unknown how often the WebKit engine is upgraded to the latest stable version that supports the latest web standards and includes the fixes of the reported security vulnerabilities.

JxBrowser is a commercial product designed and created for the commercial companies that have high requirements for the quality and support of the integrated third-party solutions, and develop software using Java technology. JxBrowser has been developed and supported by TeamDev since 2007. All the clients with an active Standard Support subscription can use all new JxBrowser versions for free and receive technical support from JxBrowser engineers directly. If you see a bug or there is a missing feature, we will apply the fix, implement the required feature, and provide you with a new version of the library within a reasonable amount of time. A new version of JxBrowser is released almost every month. We upgrade Chromium to the latest stable version (with the latest security patches and fixed vulnerabilities) within 3-4 weeks after its official release.


If you develop your software using JavaFX and you need to display a simple web page that with no need to use HTML5 features or advanced web browser functionality, then JavaFX WebView will work well for this case.

For time-sensitive commercial software development on JavaFX, Swing, or SWT, where modern web functionality is necessary for specific use cases, and compliance with the latest web standards is a must, JxBrowser is a safer and more customizable solution, backed by the full-time development team.

Go Top