JavaFX - 执行 WebView 示例代码时出现 java.lang.reflect.InitationTargetException

2024-02-09

我尝试运行 WebView 项目的示例,但出现此错误

C:\Users\Dell\.jdks\openjdk-19.0.1\bin\java.exe "-javaagent:D:\IntelliJ IDEA 2022.2.4\lib\idea_rt.jar=50766:D:\IntelliJ IDEA 2022.2.4\bin" -Dfile.encoding=UTF-8 -Dsun.stdout.encoding=UTF-8 -Dsun.stderr.encoding=UTF-8 -classpath C:\Users\Dell\Desktop\javafx-dialogs-0.0.4.jar;C:\Users\Dell\.m2\repository\org\icepdf\os\icepdf-viewer\6.1.2\icepdf-viewer-6.1.2.jar;C:\Users\Dell\.m2\repository\org\icepdf\os\icepdf-core\6.1.2\icepdf-core-6.1.2.jar;C:\Users\Dell\.m2\repository\org\bouncycastle\bcprov-jdk15on\1.54\bcprov-jdk15on-1.54.jar;C:\Users\Dell\.m2\repository\org\bouncycastle\bcprov-ext-jdk15on\1.54\bcprov-ext-jdk15on-1.54.jar;C:\Users\Dell\.m2\repository\org\bouncycastle\bcpkix-jdk15on\1.54\bcpkix-jdk15on-1.54.jar;C:\Users\Dell\.m2\repository\javax\media\jai-core\1.1.3\jai-core-1.1.3.jar;C:\Users\Dell\.m2\repository\com\sun\media\jai_imageio\1.1\jai_imageio-1.1.pom;C:\Users\Dell\.m2\repository\batik\batik-awt-util\1.6\batik-awt-util-1.6.jar;C:\Users\Dell\.m2\repository\batik\batik-dom\1.6\batik-dom-1.6.jar;C:\Users\Dell\.m2\repository\batik\batik-svg-dom\1.6\batik-svg-dom-1.6.jar;C:\Users\Dell\.m2\repository\batik\batik-svggen\1.6\batik-svggen-1.6.jar;C:\Users\Dell\.m2\repository\batik\batik-util\1.6\batik-util-1.6.jar;C:\Users\Dell\.m2\repository\batik\batik-xml\1.6\batik-xml-1.6.jar;C:\Users\Dell\.m2\repository\org\jfxcore\javafx-media\18-ea+1\javafx-media-18-ea+1.jar;C:\Users\Dell\.m2\repository\org\jfxcore\javafx-graphics\18-ea+1\javafx-graphics-18-ea+1.jar;C:\Users\Dell\.m2\repository\org\jfxcore\javafx-base\18-ea+1\javafx-base-18-ea+1.jar;C:\Users\Dell\.m2\repository\org\eclipse\jetty\websocket\websocket-api\9.4.46.v20220331\websocket-api-9.4.46.v20220331.jar;C:\Users\Dell\.m2\repository\org\webjars\webjars-locator\0.30\webjars-locator-0.30.jar;C:\Users\Dell\.m2\repository\org\webjars\webjars-locator-core\0.30\webjars-locator-core-0.30.jar;C:\Users\Dell\.m2\repository\org\slf4j\slf4j-api\1.7.7\slf4j-api-1.7.7.jar;C:\Users\Dell\.m2\repository\org\apache\commons\commons-compress\1.9\commons-compress-1.9.jar;C:\Users\Dell\.m2\repository\com\fasterxml\jackson\core\jackson-databind\2.3.3\jackson-databind-2.3.3.jar;C:\Users\Dell\.m2\repository\com\fasterxml\jackson\core\jackson-annotations\2.3.0\jackson-annotations-2.3.0.jar;C:\Users\Dell\.m2\repository\com\fasterxml\jackson\core\jackson-core\2.3.3\jackson-core-2.3.3.jar;C:\Users\Dell\.m2\repository\org\apache\commons\commons-lang3\3.4\commons-lang3-3.4.jar;C:\Users\Dell\.m2\repository\org\openjfx\javafx-controls\19-ea+7\javafx-controls-19-ea+7.jar;C:\Users\Dell\.m2\repository\org\openjfx\javafx-graphics\19-ea+7\javafx-graphics-19-ea+7.jar;C:\Users\Dell\.m2\repository\org\openjfx\javafx-base\19-ea+7\javafx-base-19-ea+7.jar;C:\Users\Dell\.m2\repository\org\openjfx\javafx-fxml\19-ea+7\javafx-fxml-19-ea+7.jar;C:\Users\Dell\.m2\repository\org\openjfx\javafx-web\19-ea+7\javafx-web-19-ea+7.jar;C:\Users\Dell\.m2\repository\org\openjfx\javafx-media\19-ea+7\javafx-media-19-ea+7.jar;C:\Users\Dell\.m2\repository\net\synedra\validatorfx\0.3.1\validatorfx-0.3.1.jar -p "C:\Users\Dell\IdeaProjects\PFEL\target\classes;C:\Users\Dell\.m2\repository\org\openjfx\javafx-web\19-ea+7\javafx-web-19-ea+7-win.jar;C:\Users\Dell\.m2\repository\org\openjfx\javafx-fxml\19-ea+7\javafx-fxml-19-ea+7-win.jar;C:\Users\Dell\.m2\repository\org\kordamp\bootstrapfx\bootstrapfx-core\0.4.0\bootstrapfx-core-0.4.0.jar;D:\MI\3LMD\memoire\Nouveau dossier\JavaFxLibs\mysql-connector-java-5.1.42-bin.jar;C:\Users\Dell\.m2\repository\org\openjfx\javafx-controls\19-ea+7\javafx-controls-19-ea+7-win.jar;C:\Users\Dell\.m2\repository\org\kordamp\ikonli\ikonli-javafx\12.3.1\ikonli-javafx-12.3.1.jar;C:\Users\Dell\.m2\repository\org\kordamp\ikonli\ikonli-core\12.3.1\ikonli-core-12.3.1.jar;C:\Users\Dell\.m2\repository\org\jfxcore\javafx-graphics\18-ea+1\javafx-graphics-18-ea+1-win.jar;C:\Users\Dell\.m2\repository\org\openjfx\javafx-graphics\19-ea+7\javafx-graphics-19-ea+7-win.jar;C:\Users\Dell\.m2\repository\org\jfxcore\javafx-media\18-ea+1\javafx-media-18-ea+1-win.jar;C:\Users\Dell\.m2\repository\org\openjfx\javafx-media\19-ea+7\javafx-media-19-ea+7-win.jar;C:\Users\Dell\.m2\repository\com\dlsc\formsfx\formsfx-core\11.5.0\formsfx-core-11.5.0.jar;C:\Users\Dell\.m2\repository\org\jfxcore\javafx-base\18-ea+1\javafx-base-18-ea+1-win.jar;C:\Users\Dell\.m2\repository\org\openjfx\javafx-base\19-ea+7\javafx-base-19-ea+7-win.jar;C:\Users\Dell\.m2\repository\org\controlsfx\controlsfx\11.1.1\controlsfx-11.1.1.jar" -m com.example.pfel/com.example.pfel.Elearning
Exception in Application start method
java.lang.reflect.InvocationTargetException
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:119)
    at java.base/java.lang.reflect.Method.invoke(Method.java:578)
    at javafx.graphics@18-ea/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:465)
    at javafx.graphics@18-ea/com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:364)
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
    at java.base/java.lang.reflect.Method.invoke(Method.java:578)
    at java.base/sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:1081)
Caused by: java.lang.RuntimeException: Exception in Application start method
    at javafx.graphics@18-ea/com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:901)
    at javafx.graphics@18-ea/com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:196)
    at java.base/java.lang.Thread.run(Thread.java:1589)
Caused by: javafx.fxml.LoadException: 
/C:/Users/Dell/IdeaProjects/PFEL/target/classes/com/example/pfel/Html.fxml:11

    at javafx.fxml@19-ea/javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2707)
    at javafx.fxml@19-ea/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2685)
    at javafx.fxml@19-ea/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2548)
    at javafx.fxml@19-ea/javafx.fxml.FXMLLoader.load(FXMLLoader.java:2516)
    at com.example.pfel/com.example.pfel.Elearning.start(Elearning.java:14)
    at javafx.graphics@18-ea/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:847)
    at javafx.graphics@18-ea/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:497)
    at javafx.graphics@18-ea/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:470)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
    at javafx.graphics@18-ea/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:469)
    at javafx.graphics@18-ea/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
    at javafx.graphics@18-ea/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at javafx.graphics@18-ea/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:180)
    ... 1 more
Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at javafx.fxml@19-ea/javafx.fxml.JavaFXBuilderFactory$ObjectBuilderWrapper$ObjectBuilder.build(JavaFXBuilderFactory.java:237)
    at javafx.fxml@19-ea/javafx.fxml.FXMLLoader$ValueElement.processEndElement(FXMLLoader.java:774)
    at javafx.fxml@19-ea/javafx.fxml.FXMLLoader.processEndElement(FXMLLoader.java:2924)
    at javafx.fxml@19-ea/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2639)
    ... 12 more
Caused by: java.lang.reflect.InvocationTargetException
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:119)
    at java.base/java.lang.reflect.Method.invoke(Method.java:578)
    at javafx.fxml@19-ea/javafx.fxml.JavaFXBuilderFactory$ObjectBuilderWrapper$ObjectBuilder.build(JavaFXBuilderFactory.java:229)
    ... 15 more
Caused by: java.lang.NoSuchMethodError: 'void com.sun.javafx.application.PlatformImpl.setDefaultPlatformUserAgentStylesheet()'
    at javafx.controls@19-ea/javafx.scene.control.Control.<clinit>(Control.java:99)
    at javafx.web@19-ea/com.sun.javafx.webkit.theme.ScrollBarThemeImpl$1.invalidated(ScrollBarThemeImpl.java:84)
    at javafx.base@18-ea/com.sun.javafx.binding.ExpressionHelper$Generic.fireValueChangedEvent(ExpressionHelper.java:348)
    at javafx.base@18-ea/com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:80)
    at javafx.base@18-ea/javafx.beans.property.ObjectPropertyBase.fireValueChangedEvent(ObjectPropertyBase.java:106)
    at javafx.base@18-ea/javafx.beans.property.ObjectPropertyBase.markInvalid(ObjectPropertyBase.java:113)
    at javafx.base@18-ea/javafx.beans.property.ObjectPropertyBase.set(ObjectPropertyBase.java:147)
    at javafx.base@18-ea/javafx.beans.property.ObjectProperty.setValue(ObjectProperty.java:78)
    at javafx.web@19-ea/javafx.scene.web.WebEngine.setView(WebEngine.java:997)
    at javafx.web@19-ea/javafx.scene.web.WebView.<init>(WebView.java:276)
    at javafx.web@19-ea/com.sun.javafx.fxml.builder.web.WebViewBuilder.build(WebViewBuilder.java:66)
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
    ... 17 more
Exception running application com.example.pfel.Elearning

Process finished with exit code 1

这是 fxml 文件和控制器

FXML:

<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.scene.control.Button?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.web.WebView?>


<AnchorPane prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.example.pfel.Html">
   <children>
      <WebView fx:id="webview" layoutX="6.0" layoutY="4.0" prefHeight="333.0" prefWidth="590.0" />
      <Button layoutX="27.0" layoutY="361.0" mnemonicParsing="false" onAction="#loadpage" text="load" />
      <TextField fx:id="textfield" layoutX="145.0" layoutY="361.0" onAction="#loadpage" />
   </children>
</AnchorPane>

控制器:

package com.example.pfel;

import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.TextField;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebView;

import java.net.URL;
import java.util.ResourceBundle;

public class Html implements Initializable {
    @FXML
    private WebView webview;
    @FXML
    private TextField textfield;
    private WebEngine engine;
    @Override
    public void initialize(URL location, ResourceBundle resources) {
        engine = webview.getEngine();
        loadpage();
    }
    public void loadpage(){

    }

}


None

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

JavaFX - 执行 WebView 示例代码时出现 java.lang.reflect.InitationTargetException 的相关文章

  • 为 tableView JavaFx 中没有第一个(行数)的列设置 CONSTRAINED_RESIZE_POLICY

    我的 tableView 的第一列为行号 我想为没有第一个列的所有列设置 CONSTRAINED RESIZE POLICY I made First column implementation column setPrefWidth 40
  • JavaScript 反静默技术来指示失败

    当错误确实发生并且函数无法继续执行时 在 JavaScript 中报告错误而不是依赖 null 和 undefined 是一个好方法 我可以想到三种方法 没做什么 抛出异常 assert 这是一个简单的示例场景 一个将传入的金额记入用户帐户
  • JavaFX - 如何从另一个控制器使用一个控制器中的方法?

    使用场景构建器 我有 2 个阶段 每个阶段都有一个控制器 stage1Controller stage2Controller Stage1控制器 public class Stage1Controller FXML private Menu
  • 类型错误:在自定义 python 函数中找到预期字节、str

    我正在使用一种名为 Giggle 的新生物信息学工具 并且我已经在我的系统上安装了 python 包装器 尽管场景非常具体 但我认为问题非常普遍 这个功能 index Giggle create index HMEC hg19 BroadH
  • Perl6:我怎样才能使所有警告都是致命的?

    我怎样才能使 Perl6 中的所有警告都是致命的 以便脚本在屏幕上出现警告时立即终止 CONTROL when CX Warn note exit 1 更频繁地死亡 该脚本终止于CONTROL when CX Warn note exit
  • Javafx 可拆卸窗格系统

    这是我在几个不同的软件中看到的我喜欢的东西 我不知道它来自哪里 也不知道它的真正名称是什么 但这里是 Visual Studio 中的窗格系统的示例 请注意我如何轻松地将窗格固定在任何地方 Javafx 可以实现这样的事情吗 我知道这个问题
  • JavaFX - 当文本字段具有焦点时加速器不工作

    在我的应用程序中 我有一个使用加速器的屏幕 我正在使用功能键 F3 在我的应用程序中执行操作 它每次都工作正常 但是当我单击此屏幕上的任何文本字段时 功能键不会执行 这是我设置加速器的代码 scene getAccelerators put
  • 如何平滑拖动JavaFX多边形?

    我有一个多边形 三角形 我想让它可以用鼠标拖动 下面是我尝试过的代码 但是使用此代码我无法顺利拖动它 请让我知道如何才能使其顺利拖动 public void start Stage primaryStage throws Exception
  • 如何在 JavaFX 中设置滚动窗格的单位增量?

    The 滚动条 http docs oracle com javafx 2 api javafx scene control ScrollBar htmlJavaFX 中的类包含一个用于设置单位增量的属性 这就是我所追求的 但是我找不到如何
  • JavaFX 多线程 - 连接线程不会更新 UI

    我正在尝试创建一个加载程序对话框 用户可以在其中知道程序正在加载所请求的内容并且程序正在按预期运行 但正因为如此 我需要join 解析器线程和之前继续主线程 这使得对话框空白 解析器任务 java public class ParserTa
  • 在 WebView 中拦截 POST 请求

    我正在开发一个 Android 应用程序来过滤请求 使用白名单 并使用自定义SSLSocketFactory 为此 我开发了一个自定义的WebViewClient我已经覆盖了shouldInterceptRequest方法 我可以过滤并使用
  • Android:带有链接突出显示的Webview

    我正在 android 上使用 WebView 似乎无法弄清楚如何使库存浏览器中出现的橙色突出显示出现在我的 webview 上 为了更清楚地说明这一点 让我举个例子 在 Android 浏览器中 如果您单击链接 图像 视频 它将显示一个覆
  • 我们如何在 Golang 中组合多个错误字符串?

    我是 golang 新手 我的应用程序需要在循环中返回多个错误 稍后需要组合并作为单个错误字符串返回 我无法使用字符串函数来组合错误消息 在返回之前可以使用什么方法将这些错误合并为一个错误 package main import fmt s
  • Android - 如何在运行时生成的 HTML 数据中加载外部 javascript 文件?

    我有一个包含 HTML 数据的 WebView 数据是在运行时生成的 我的应用程序的一个主要功能是突出显示该 HTML 数据的某些部分 我用 javascript 尝试过这个 Override public View onCreateVie
  • 如何在 vb.net 中使用 Stacktrace 返回错误行号

    我正在尝试创建某种错误捕获方法来返回错误行号 当进程中止时 我们会发送一封中止电子邮件 该电子邮件为我们提供了错误号 and 错误描述但我想知道实际上哪里出了错误 我知道你可以执行以下操作 1 code here 2 code here 3
  • 如何处理用户界面中的数据库约束违规?

    我们使用存储过程在数据库中实现大部分业务规则 我永远无法决定如何最好地将数据约束违规错误从数据库传递回用户界面 我所说的约束更多地与业务规则相关 而不是与数据完整性相关 例如 诸如 无法插入重复的键行 之类的数据库错误与业务规则 不能有多个
  • 如何右对齐 Javafx 工具栏中的按钮

    我正在使用 Java FX 场景生成器构建 UI 并且希望工具栏中的按钮浮动到工具栏的右侧 我尝试更改父级 工具栏 和按钮的节点方向 但两者似乎都被忽略 添加一个没有内容的窗格 该窗格始终会增长以适应工具栏中左对齐工具和右对齐工具之间的可用
  • 如何在JavaFX中有效地滚动和缩放大图像?

    作为图像处理应用程序的一部分 我需要创建具有缩放 滚动和矢量叠加功能的简单查看器模块 图像相当大 40000x20000 这使得 ImageView 上的操作变慢 缓冲等 在 JavaFX 中处理巨大图像时 改善用户体验的最佳选项是什么 我
  • JavaFX Integer Spinner (IntegerSpinnerValueFactory) 不会将值回绕到最小值

    我创建了一个带有值的整数微调器 min 5 max 15 and initialValue 12 and wrapAround true 一旦旋转器到达max 15 增量期间的值 而不是将值重置为min 5 正如它所说文档 https op
  • 如何针对 Node.js 中发生的每个错误发送电子邮件?

    假设我的 node js 应用程序正在运行 如果出现错误 我的意思是所有错误 不仅仅是网络错误 如果出现错误 则很重要 我如何调用函数向我发送电子邮件 基本上 在我希望它写入 err out 之前 我希望向我发送一封电子邮件 我正在使用no

随机推荐