I'm trying to embedd the JXBrowser into a SpringBoot JavaFX Application running with Java11. My Problem is that the browser is not shown on the scene when I run the application from the created executable jar. The browser is loaded, gives feedback about the loaded website and is already part of the scene, but not visible. Running inside IntelliJ or with Maven exec is currently working. When I switch the browser mod to LIGHTWEIGHT than all of the three run possibilities are working fine. What is the the Problem with running from jar in HEAVYWEIGHT mod?
My system: Windows10-64, Java11, SpringBoot 2.1.0.RELEASE, JXBrowser 6.21, OpenJFX 11
Main.class
@Slf4j
@SpringBootApplication
public class Main extends Application
{
private ConfigurableApplicationContext springContext;
public static void main(final String[] args)
{
Application.launch(args);
}
@Override
public void init()
{
springContext = SpringApplication.run(Main.class);
springContext.getAutowireCapableBeanFactory().autowireBean(this);
}
@Override
public void start(Stage stage)
{
final Browser browser = new Browser();
stage.setScene(new Scene(new BrowserView(browser)));
stage.show();
browser.loadURL("http://www.google.de");
}
@Override
public void stop()
{
springContext.close();
}
}
StartMain.class
public class StartMain
{
public static void main(String[] args)
{
Main.main(args);
}
}
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<groupId>de</groupId>
<artifactId>app</artifactId>
<version>1.0.10-SNAPSHOT</version>
<modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.0.RELEASE</version>
<relativePath/>
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>11</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<jxbrowser.version>6.21</jxbrowser.version>
<javafx.version>11</javafx.version>
</properties>
<repositories>
<repository>
<id>com.teamdev</id>
<url>http://maven.teamdev.com/repository/products</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.teamdev.jxbrowser</groupId>
<artifactId>jxbrowser-cross-platform</artifactId>
<type>pom</type>
<version>${jxbrowser.version}</version>
</dependency>
<dependency>
<groupId>com.teamdev.jxbrowser</groupId>
<artifactId>jxbrowser-win64</artifactId>
<version>${jxbrowser.version}</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-base</artifactId>
<version>${javafx.version}</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>${javafx.version}</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>${javafx.version}</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-graphics</artifactId>
<version>${javafx.version}</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-swing</artifactId>
<version>${javafx.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<includeSystemScope>true</includeSystemScope>
<mainClass>...StartMain</mainClass>
<layout>ZIP</layout>
</configuration>
<executions>
<execution>
<goals>
<goal>build-info</goal>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>