GluonFX, собственное изображение и java.lang.ClassNotFoundException: javafx.scene.web.WebView
Я пытаюсь преобразовать свою программу javaFX в собственный образ под Windows, используя плагин GluonFX и Maven.
Поскольку я использую javafx WebView, сгенерированный exe-файл во время его выполнения сообщает мне об ошибке:
java.lang.ClassNotFoundException: javafx.scene.web.WebView
Моя - это простая программа, которая использует WebView и WebEngine, полностью работоспособную под JVM, в NetBeans.
Есть ли пример программы, которая использует WebView и преобразуется в собственный образ с помощью GluonFX?
Проблема кажется мне непреодолимой, и я прошу помощи. Следующее сообщение об ошибке:
[lun nov 15 18:41:08 CET 2021][INFO] [SUB] WARNING: Unsupported JavaFX configuration: classes were loaded from 'unnamed module @3722c145'
[lun nov 15 18:41:09 CET 2021][INFO] [SUB] Exception in Application start method
[lun nov 15 18:41:09 CET 2021][INFO] [SUB] Exception in thread "main" java.lang.RuntimeException: Exception in Application start method
[lun nov 15 18:41:09 CET 2021][INFO] [SUB] at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:901)
[lun nov 15 18:41:09 CET 2021][INFO] [SUB] at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:196)
[lun nov 15 18:41:09 CET 2021][INFO] [SUB] at java.lang.Thread.run(Thread.java:829)
[lun nov 15 18:41:09 CET 2021][INFO] [SUB] at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:552)
[lun nov 15 18:41:09 CET 2021][INFO] [SUB] at com.oracle.svm.core.windows.WindowsJavaThreads.osThreadStartRoutine(WindowsJavaThreads.java:138)
[lun nov 15 18:41:09 CET 2021][INFO] [SUB] Caused by: java.lang.AssertionError: java.lang.ClassNotFoundException: javafx.scene.web.WebView
Файл pom был создан NetBeans, а компиляция выполнялась через терминал:
- Подсказка о собственных средствах x64 для VS 2019
Моя программа на Java:
package com.gluonapplication;
import com.gluonhq.charm.glisten.application.MobileApplication;
import com.gluonhq.charm.glisten.visual.Swatch;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.stage.Stage;
import java.io.IOException;
import javafx.scene.web.WebHistory;
import javafx.scene.web.WebHistory.Entry;
import javafx.scene.web.WebView;
import javafx.stage.Stage;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.StackPane;
import javafx.scene.web.WebEngine;
public class GluonApplication extends Application {// MobileApplication
@Override
public void start(Stage stage) throws Exception {
StackPane root = new StackPane();
WebView view = new WebView();
WebEngine engine = view.getEngine();
engine.load("https://stackoverflow.com");
root.getChildren().add(view);
Scene scene = new Scene(root, 800, 600);
stage.setScene(scene);
stage.show();
}
public static void main(String args[]) {
launch(args);
}
}
Пом:
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.gluonapplication</groupId>
<artifactId>gluonapplication</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>GluonApplication</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.release>11</maven.compiler.release>
<javafx.version>16</javafx.version>
<attach.version>4.0.11</attach.version>
<gluonfx.plugin.version>1.0.3</gluonfx.plugin.version>
<javafx.plugin.version>0.0.6</javafx.plugin.version>
<mainClassName>com.gluonapplication.GluonApplication</mainClassName>
</properties>
<dependencies>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>${javafx.version}</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-web</artifactId>
<version>${javafx.version}</version>
</dependency>
<dependency>
<groupId>com.gluonhq</groupId>
<artifactId>charm-glisten</artifactId>
<version>6.0.6</version>
</dependency>
<dependency>
<groupId>com.gluonhq.attach</groupId>
<artifactId>display</artifactId>
<version>${attach.version}</version>
</dependency>
<dependency>
<groupId>com.gluonhq.attach</groupId>
<artifactId>lifecycle</artifactId>
<version>${attach.version}</version>
</dependency>
<dependency>
<groupId>com.gluonhq.attach</groupId>
<artifactId>statusbar</artifactId>
<version>${attach.version}</version>
</dependency>
<dependency>
<groupId>com.gluonhq.attach</groupId>
<artifactId>storage</artifactId>
<version>${attach.version}</version>
</dependency>
<dependency>
<groupId>com.gluonhq.attach</groupId>
<artifactId>util</artifactId>
<version>${attach.version}</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>Gluon</id>
<url>https://nexus.gluonhq.com/nexus/content/repositories/releases</url>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
</plugin>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>${javafx.plugin.version}</version>
<configuration>
<mainClass>${mainClassName}</mainClass>
</configuration>
<executions>
<execution>
<!-- Default configuration for running -->
<!-- Usage: mvn clean javafx:run -->
<id>default-cli</id>
</execution>
<execution>
<!-- Configuration for manual attach debugging -->
<!-- Usage: mvn clean javafx:run@debug -->
<id>debug</id>
<configuration>
<options>
<option>-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=localhost:8000
</option>
</options>
</configuration>
</execution>
<execution>
<!-- Configuration for automatic IDE debugging -->
<id>ide-debug</id>
<configuration>
<options>
<option>-agentlib:jdwp=transport=dt_socket,server=n,address=${jpda.address}</option>
</options>
</configuration>
</execution>
<execution>
<!-- Configuration for automatic IDE profiling -->
<id>ide-profile</id>
<configuration>
<options>
<option>${profiler.jvmargs.arg1}</option>
<option>${profiler.jvmargs.arg2}</option>
<option>${profiler.jvmargs.arg3}</option>
<option>${profiler.jvmargs.arg4}</option>
<option>${profiler.jvmargs.arg5}</option>
</options>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.gluonhq</groupId>
<artifactId>gluonfx-maven-plugin</artifactId>
<version>${gluonfx.plugin.version}</version>
<configuration>
<target>${gluonfx.target}</target>
<attachList>
<list>display</list>
<list>lifecycle</list>
<list>statusbar</list>
<list>storage</list>
</attachList>
<mainClass>${mainClassName}</mainClass>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>ios</id>
<properties>
<gluonfx.target>ios</gluonfx.target>
</properties>
</profile>
<profile>
<id>android</id>
<properties>
<gluonfx.target>android</gluonfx.target>
</properties>
</profile>
</profiles>
</project>