Standalone mode

Standalone mode lets you launch a Chromium-powered browser window directly from Java without using Swing, SWT or any other GUI toolkit. Equo Chromium will automatically create and manage the window for you. In other words, 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.

Basic usage example

To use Standalone mode, simply call the static methods on the ChromiumBrowser class. For example, you might write something like this in your main method:

import com.equo.chromium.ChromiumBrowser;

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().