Search code examples
javamavenintellij-ideajavafxjxbrowser

Language level stuck at 7 when running JxBrowser example code?


I'm essentially just trying to get one of the JxBrowser example projects working by combining it with a basic JavaFX/Maven project. When I run

mvn clean javafx:run

with the JxBrowser example code enabled (and the stock JavaFX code commented out), I get the following message:

[28,32] static interface method invocations are not supported in -source 7 (use -source 8 or higher to enable static interface method invocations)

Java/FX Maven example project

JxBrowser example (this curiously does not have JavaFX included in the pom.xml file)

My GitHub repo

My Java HelloWorld file (JxBrowser example code is commented out in this version)

Based on my searches on this issue, I've tried changing the language level in my Intellij Project Structure, but this seems to have no effect on the outcome. I'm running OpenJDK version 17.0.6, so I'm not entirely sure why this would be an issue. Is there anything I'm missing (I'm not very experienced so take it easy on me lol)?

EDIT: Here is the pom.xml file I'm currently running:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>org.openjfx</groupId>
  <artifactId>hellofx</artifactId>
  <packaging>jar</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>demo</name>
  <url>http://maven.apache.org</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <javafx.version>19</javafx.version>
    <javafx.maven.plugin.version>0.0.8</javafx.maven.plugin.version>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
  </properties>

  <repositories>
    <repository>
      <id>com.teamdev</id>
      <url>https://europe-maven.pkg.dev/jxbrowser/releases</url>
    </repository>
  </repositories>

  <dependencies>
    <dependency>
      <groupId>org.openjfx</groupId>
      <artifactId>javafx-controls</artifactId>
      <version>${javafx.version}</version>
    </dependency>
    <dependency>
      <groupId>com.teamdev.jxbrowser</groupId>
      <artifactId>jxbrowser-cross-platform</artifactId>
      <version>7.32</version>
      <type>pom</type>
    </dependency>
    <dependency>
      <groupId>com.teamdev.jxbrowser</groupId>
      <artifactId>jxbrowser-javafx</artifactId>
      <version>7.32</version>
    </dependency>
  </dependencies>
  
  <build>
    <plugins>
      <plugin>
        <groupId>org.openjfx</groupId>
        <artifactId>javafx-maven-plugin</artifactId>
        <version>${javafx.maven.plugin.version}</version>
        <configuration>
          <mainClass>HelloFX</mainClass>
        </configuration>
      </plugin>
    </plugins>
  </build>
  
</project>

And here is the Java file:

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.view.javafx.BrowserView;

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;

public class HelloFX extends Application {

//    @Override
//    public void start(Stage stage) {
//        String javaVersion = System.getProperty("java.version");
//        String javafxVersion = System.getProperty("javafx.version");
//        Label l = new Label("Hello, JavaFX " + javafxVersion + ", running on Java " + javaVersion + ".");
//        Scene scene = new Scene(new StackPane(l), 640, 480);
//        stage.setScene(scene);
//        stage.show();
//    }

     @Override
     public void start(Stage primaryStage) {
         // Initialize Chromium.
         Engine engine = Engine.newInstance(HARDWARE_ACCELERATED);

         Browser browser = engine.newBrowser();

         // Load the required web page.
         browser.navigation().loadUrl("https://html5test.com");

         // Create and embed JavaFX BrowserView component to display web content.
         BrowserView view = BrowserView.newInstance(browser);

         Scene scene = new Scene(new StackPane(view), 1280, 800);
         primaryStage.setTitle("JxBrowser JavaFX");
         primaryStage.setScene(scene);
         primaryStage.show();

         // Shutdown Chromium and release allocated resources.
         primaryStage.setOnCloseRequest(event -> engine.close());
     }

    public static void main(String[] args) {
        launch();
    }




}

EDIT 2: Here is the full readout on the new error I'm seeing.


[INFO] Scanning for projects...
[INFO] 
[INFO] ------------------------< org.openjfx:hellofx >-------------------------
[INFO] Building demo 1.0-SNAPSHOT
[INFO]   from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- clean:3.2.0:clean (default-clean) @ hellofx ---
[INFO] Deleting /home/palmisano64/Documents/SIT/EE552/Test/alex-Maven/hellofx/target
[INFO] 
[INFO] >>> javafx:0.0.8:run (default-cli) > process-classes @ hellofx >>>
[INFO] 
[INFO] --- resources:3.3.0:resources (default-resources) @ hellofx ---
[INFO] skip non existing resourceDirectory /home/palmisano64/Documents/SIT/EE552/Test/alex-Maven/hellofx/src/main/resources
[INFO] 
[INFO] --- compiler:3.10.1:compile (default-compile) @ hellofx ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /home/palmisano64/Documents/SIT/EE552/Test/alex-Maven/hellofx/target/classes
[INFO] 
[INFO] <<< javafx:0.0.8:run (default-cli) < process-classes @ hellofx <<<
[INFO] 
[INFO] 
[INFO] --- javafx:0.0.8:run (default-cli) @ hellofx ---
[WARNING] There are 1 pathException(s). The related dependencies will be ignored.
[WARNING] Dependency: /home/palmisano64/.m2/repository/com/teamdev/jxbrowser/jxbrowser-cross-platform/7.32/jxbrowser-cross-platform-7.32.pom
   - exception: Only outputDirectories and jars are accepted on the path
Exception in Application start method
java.lang.reflect.InvocationTargetException
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at javafx.graphics@20/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:464)
        at javafx.graphics@20/com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:363)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at java.base/sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:1082)
Caused by: java.lang.RuntimeException: Exception in Application start method
        at javafx.graphics@20/com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:893)
        at javafx.graphics@20/com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:195)
        at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: com.teamdev.jxbrowser.engine.NoLicenseException
        at com.teamdev.jxbrowser.engine.internal.LicenseExceptionFactory.create(LicenseExceptionFactory.java:65)
        at com.teamdev.jxbrowser.engine.internal.EngineImpl.newInstance(EngineImpl.java:280)
        at com.teamdev.jxbrowser.engine.Engine.newInstance(Engine.java:163)
        at com.teamdev.jxbrowser.engine.Engine.newInstance(Engine.java:117)
        at HelloFX.start(HelloFX.java:28)
        at javafx.graphics@20/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:839)
        at javafx.graphics@20/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:483)
        at javafx.graphics@20/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:456)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
        at javafx.graphics@20/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:455)
        at javafx.graphics@20/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
        at javafx.graphics@20/com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
        at javafx.graphics@20/com.sun.glass.ui.gtk.GtkApplication.lambda$runLoop$11(GtkApplication.java:316)
        ... 1 more
Exception running application HelloFX
[ERROR] Command execution failed.
org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
    at org.apache.commons.exec.DefaultExecutor.executeInternal (DefaultExecutor.java:404)
    at org.apache.commons.exec.DefaultExecutor.execute (DefaultExecutor.java:166)
    at org.openjfx.JavaFXBaseMojo.executeCommandLine (JavaFXBaseMojo.java:567)
    at org.openjfx.JavaFXBaseMojo.executeCommandLine (JavaFXBaseMojo.java:434)
    at org.openjfx.JavaFXRunMojo.execute (JavaFXRunMojo.java:105)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:342)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:330)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:213)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:175)
    at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:76)
    at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:163)
    at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:160)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:827)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:272)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:195)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:568)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
        at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:404)
        at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:166)
        at org.openjfx.JavaFXBaseMojo.executeCommandLine(JavaFXBaseMojo.java:567)
        at org.openjfx.JavaFXBaseMojo.executeCommandLine(JavaFXBaseMojo.java:434)
        at org.openjfx.JavaFXRunMojo.execute(JavaFXRunMojo.java:105)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:126)
        at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2(MojoExecutor.java:342)
        at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute(MojoExecutor.java:330)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:175)
        at org.apache.maven.lifecycle.internal.MojoExecutor.access$000(MojoExecutor.java:76)
        at org.apache.maven.lifecycle.internal.MojoExecutor$1.run(MojoExecutor.java:163)
        at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute(DefaultMojosExecutionStrategy.java:39)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:160)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:105)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:73)
        at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:53)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:118)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:261)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:173)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:101)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:827)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:272)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:195)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  22.015 s
[INFO] Finished at: 2023-05-08T15:52:12-04:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.openjfx:javafx-maven-plugin:0.0.8:run (default-cli) on project hellofx: Error: Command execution failed. Process exited with an error: 1 (Exit value: 1) -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

EDIT 3: mvn -v output:

Apache Maven 3.9.1 (2e178502fcdbffc201671fb2537d0cb4b4cc58f8)
Maven home: /opt/apache-maven-3.9.1
Java version: 17.0.6, vendor: Eclipse Adoptium, runtime: /home/palmisano64/.sdkman/candidates/java/17.0.6-tem
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "6.1.21-v8+", arch: "aarch64", family: "unix"

Solution

  • Caveat: I am not an expert on JxBrowser. I had not heard of it before today.

    No license

    Excerpt from your error message:

    Caused by: com.teamdev.jxbrowser.engine.NoLicenseException

    JxBrowser is commercial software, requiring a fee. The vendor does provide a free 30-day trial.

    Apparently you either do not have a license, or you have misconfigured the license files needed to execute JxBrowser.

    Your code for establishing the JxBrowser engine seems to be too brief. The example code from xxx shows the following. Notice the call to licenseKey where you pass your license key as a string.

    EngineOptions options =
            EngineOptions
                    .newBuilder( HARDWARE_ACCELERATED )
                    .licenseKey( "your_license_code_goes_here" )
                    .build();
    Engine engine = Engine.newInstance( options );
    

    There may be other ways to configure the license, but that one worked for me with my 30-day free trial license I obtained today.

    Java version

    Your question does not document what settings you used to establish your Java version.

    In IntelliJ, changing the Java version is quite a chore. You must reach into multiple nooks and crannies of IntelliJ settings as well as your Maven or Gradle configuration. Search Stack Overflow to learn more, as this has been covered already. I'll list some of the places briefly.

    • IntelliJ > Preferences > Build, Execution, Deployment > Compiler > Java Compiler > Module & Target bytecode version
    • IntelliJ > File > Project structure > Project Settings > Project > SDK (and Language Level)
    • IntelliJ > File > Project structure > Project Settings > Modules > Sources > language level
    • Maven POM, with a plugin as shown next, with a release element.
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.11.0</version>
        <configuration>
            <release>20</release>
        </configuration>
    </plugin>
    

    Example app

    If it helps, I can post the parts of an example app I got running today. I noticed too late that the TeamDev company provides a template on GitHub. So instead, I:

    1. Created a new JavaFX project in IntelliJ using the built-in JavaFX project template.
    2. Ran that project successfully.
    3. Ripped out the FXML parts, though I imagine you could leave those in place and ignore them.
    4. Tweaked the POM file to add JxBrowser elements, and update to latest version of everything.
    5. Copied code from this JxBrowser Quick Start page.
    6. Copy-pasted four --add-opens items from the second block shown in the Embedding into JFXPanel section of the JxBrowser page, Frequently Encountered Issues. I pasted into Run/Debug Configurations dialog in IntelliJ, where I had to use the pop-up menu Modify options to check the Add VM options item which makes visible a field for pasting.
    7. Used IntelliJ fix-it suggestions to modify my module-info.java file, as shown below.
    --add-opens javafx.swing/javafx.embed.swing=jxbrowser
    --add-opens javafx.graphics/com.sun.javafx.stage=jxbrowser
    --add-exports javafx.graphics/com.sun.javafx.stage=jxbrowser
    --add-exports javafx.controls/com.sun.javafx.scene.control=jxbrowser
    

    My module-info.java file:

    module work.basil.example.brzr {
        requires javafx.controls;
        requires jxbrowser;
        requires jxbrowser.javafx;
    
        exports work.basil.example.brzr;
    }
    

    My POM.xml:

    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns = "http://maven.apache.org/POM/4.0.0"
             xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation = "http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
    
        <groupId>work.basil.example</groupId>
        <artifactId>Brzr</artifactId>
        <version>1.0-SNAPSHOT</version>
        <name>Brzr</name>
    
        <properties>
            <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        </properties>
    
        <repositories>
            <repository>
                <id>com.teamdev</id>
                <url>https://europe-maven.pkg.dev/jxbrowser/releases</url>
            </repository>
        </repositories>
    
        <dependencies>
            <dependency>
                <groupId>org.openjfx</groupId>
                <artifactId>javafx-controls</artifactId>
                <version>20.0.1</version>
            </dependency>
    
            <!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter -->
            <dependency>
                <groupId>org.junit.jupiter</groupId>
                <artifactId>junit-jupiter</artifactId>
                <version>5.9.3</version>
                <scope>test</scope>
            </dependency>
    
            <dependency>
                <groupId>com.teamdev.jxbrowser</groupId>
                <artifactId>jxbrowser-cross-platform</artifactId>
                <version>7.32</version>
                <type>pom</type>
            </dependency>
    
            <dependency>
                <groupId>com.teamdev.jxbrowser</groupId>
                <artifactId>jxbrowser-javafx</artifactId>
                <version>7.32</version>
            </dependency>
    
    
        </dependencies>
    
        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.11.0</version>
                    <configuration>
                        <release>20</release>
                    </configuration>
                </plugin>
    
                <plugin>
                    <groupId>org.openjfx</groupId>
                    <artifactId>javafx-maven-plugin</artifactId>
                    <version>0.0.8</version>
                    <executions>
                        <execution>
                            <!-- Default configuration for running with: mvn clean javafx:run -->
                            <id>default-cli</id>
                            <configuration>
                                <mainClass>work.basil.example.brzr/work.basil.example.brzr.HelloApplication</mainClass>
                                <launcher>app</launcher>
                                <jlinkZipName>app</jlinkZipName>
                                <jlinkImageName>app</jlinkImageName>
                                <noManPages>true</noManPages>
                                <stripDebug>true</stripDebug>
                                <noHeaderFiles>true</noHeaderFiles>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
    
            </plugins>
        </build>
    </project>
    

    My HelloApplication.java file.

    package work.basil.example.brzr;
    
    import com.teamdev.jxbrowser.browser.Browser;
    import com.teamdev.jxbrowser.engine.Engine;
    import com.teamdev.jxbrowser.engine.EngineOptions;
    import com.teamdev.jxbrowser.view.javafx.BrowserView;
    import javafx.application.Application;
    import javafx.event.ActionEvent;
    import javafx.scene.Parent;
    import javafx.scene.Scene;
    import javafx.scene.control.Button;
    import javafx.scene.layout.BorderPane;
    import javafx.scene.layout.StackPane;
    import javafx.stage.Stage;
    
    import java.io.IOException;
    import java.time.Instant;
    
    import static com.teamdev.jxbrowser.engine.RenderingMode.HARDWARE_ACCELERATED;
    
    public class HelloApplication extends Application
    {
        @Override
        public void start ( Stage stage ) throws IOException
        {
            this.dumpEnv();
    
            // Initialize Chromium.
            EngineOptions options =
                    EngineOptions
                            .newBuilder( HARDWARE_ACCELERATED )
                            .licenseKey( "your_license_code_goes_here" )
                            .build();
            Engine engine = Engine.newInstance( options );
    
            // Create a Browser instance.
            Browser browser = engine.newBrowser();
    
            // Load the required web page.
            browser.navigation().loadUrl( "https://html5test.com" );
    
            // Create and embed JavaFX BrowserView component to display web content.
            BrowserView view = BrowserView.newInstance( browser );
    
            Scene scene = new Scene( new BorderPane( view ) , 1280 , 800 );
            stage.setTitle( "JxBrowser JavaFX" );
            stage.setScene( scene );
            stage.show();
    
            // Shutdown Chromium and release allocated resources.
            stage.setOnCloseRequest( event -> engine.close() );
        }
    
        private void dumpEnv ( )
        {
            System.out.println( "Runtime.version() = " + Runtime.version() );
        }
    
        private Parent makeParent ( )
        {
            Button btn = new Button();
            btn.setText( "Say 'Hello World'" );
            btn.setOnAction( ( ActionEvent event ) -> System.out.println( "Hello World! " + Instant.now() ) );
    
            StackPane root = new StackPane();
            root.getChildren().add( btn );
            return root;
        }
    
        public static void main ( String[] args )
        {
            launch();
        }
    }
    

    This example app ran successfully from within IntelliJ IDEA 2023.1.2 Preview (Ultimate Edition), on an M1 MacBook Pro with macOS Ventura 13.3.1, using a JDK for Java 20.0.1 from Azul Systems.

    When running, I saw a window appear within my app that looked like this:

    screenshot of running app


    By the way, I had a bit of trouble finding the JxBrowser Javadoc. Finally found it here.