Standalone mode

The Standalone mode lets you launch an Equo Chromium powered browser window directly from Java without using any GUI toolkit (like SWT or Swing). Equo Chromium will automatically create and manage the window for you. This means you can open a web browser in a plain Java app with no UI dependencies. This makes it very easy to show web content without writing any extra code realting to the window.

1. Add the browser import

Import the Equo Chromium ChromiumBrowser class:

import com.equo.chromium.ChromiumBrowser;

2. Instantiate and create the browser

Call the ChromiumBrowser.standalone(…​) method with your target URL. Then call ChromiumBrowser.startBrowsers() to start the browser event loop:

public class Standalone {
    public static void main(String[] args) {
        ChromiumBrowser browser = ChromiumBrowser.standalone(
            "https://docs.equo.dev/main/getting-started/introduction.html"
        );
        ChromiumBrowser.startBrowsers(); //[1]
    }
}

[1] ChromiumBrowser.startBrowsers() starts the browser event loop. This call will block the main thread so the Java program stays alive while the browser is open. In other words, the application waits at this line until all open browser windows have been closed. This is how the program knows to exit only after you close the window.

This blocks the current thread until you close the browser windows. If you prefer not to block the main thread, you can run with Multithread. Equo Chromium provides a system property to enable its own background message loop. To run with Multithread, please read our Multithread page.

With -Dchromium.multi_threaded_message_loop=true, Chromium will handle its events on a separate thread. In Standalone mode, this eliminates the need to call startBrowsers().