运行时的JavaFXInvocationTargetExeption
我正在尝试运行一个用javaFx构建的Otherlo框架。但当我运行该程序时,会得到以下异常输出消息:运行时的JavaFXInvocationTargetExeption,java,javafx,Java,Javafx,我正在尝试运行一个用javaFx构建的Otherlo框架。但当我运行该程序时,会得到以下异常输出消息: Exception in Application start method java.lang.reflect.InvocationTargetException at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.
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:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:567)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:464)
at javafx.graphics/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:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:567)
at java.base/sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:1051)
Caused by: java.lang.RuntimeException: Exception in Application start method
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:900)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:195)
at java.base/java.lang.Thread.run(Thread.java:835)
Caused by: java.lang.IllegalAccessError: superclass access check failed: class com.sun.javafx.sg.prism.web.NGWebView (in unnamed module @0x4161954e) cannot access class com.sun.javafx.sg.prism.NGGroup (in module javafx.graphics) because module javafx.graphics does not export com.sun.javafx.sg.prism to unnamed module @0x4161954e
at java.base/java.lang.ClassLoader.defineClass1(Native Method)
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1016)
at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:151)
at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:802)
at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:700)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:623)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
at com.eudycontreras.othello.views.GameAboutView$Link.<init>(GameAboutView.java:318)
at com.eudycontreras.othello.views.GameAboutView.getFields(GameAboutView.java:103)
at com.eudycontreras.othello.views.GameAboutView.initialize(GameAboutView.java:129)
at com.eudycontreras.othello.views.GameAboutView.initialize(GameAboutView.java:115)
at com.eudycontreras.othello.application.OthelloGameView.initialize(OthelloGameView.java:146)
at com.eudycontreras.othello.application.Othello.<init>(Othello.java:73)
at main.AgentManager.start(AgentManager.java:55)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:846)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:455)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:389)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
... 1 more
Exception running application main.AgentManager
应用程序启动方法中出现异常
java.lang.reflect.InvocationTargetException
位于java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(本机方法)
位于java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
位于java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
位于java.base/java.lang.reflect.Method.invoke(Method.java:567)
位于javafx.graphics/com.sun.javafx.application.LaunchImpl.launchApplicationWithArgs(LaunchImpl.java:464)
位于javafx.graphics/com.sun.javafx.application.LaunchImpl.launchApplication(LaunchImpl.java:363)
位于java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(本机方法)
位于java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
位于java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
位于java.base/java.lang.reflect.Method.invoke(Method.java:567)
位于java.base/sun.launcher.launchelper$FXHelper.main(launchelper.java:1051)
原因:java.lang.RuntimeException:应用程序启动方法中的异常
位于javafx.graphics/com.sun.javafx.application.LaunchImpl.launchApplication1(LaunchImpl.java:900)
在javafx.graphics/com.sun.javafx.application.LaunchImpl.lambda$launchApplication$2(LaunchImpl.java:195)
位于java.base/java.lang.Thread.run(Thread.java:835)
原因:java.lang.IllegalAccessError:超类访问检查失败:类com.sun.javafx.sg.prism.web.NGWebView(在未命名模块@0x4161954e中)无法访问类com.sun.javafx.sg.prism.NGGroup(在模块javafx.graphics中),因为模块javafx.graphics没有将com.sun.javafx.sg.prism导出到未命名模块@0x4161954e
位于java.base/java.lang.ClassLoader.defineClass1(本机方法)
位于java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1016)
位于java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:151)
位于java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:802)
位于java.base/jdk.internal.loader.BuiltinClassLoader.findclassonclasspathrnull(BuiltinClassLoader.java:700)
位于java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:623)
位于java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
位于java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
位于java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
在com.eudycontreras.othello.views.GameAboutView$链接上。(GameAboutView.java:318)
在com.eudycontreras.othello.views.GameAboutView.getFields(GameAboutView.java:103)
在com.eudycontreras.othello.views.GameAboutView.initialize(GameAboutView.java:129)上
在com.eudycontreras.othello.views.GameAboutView.initialize(GameAboutView.java:115)上
位于com.eudycontreras.othello.application.OthelloGameView.initialize(OthelloGameView.java:146)
在com.eudycontreras.othello.application.othello上(othello.java:73)
在main.AgentManager.start(AgentManager.java:55)
在javafx.graphics/com.sun.javafx.application.launchempl.lambda$launchApplication1$9(launchempl.java:846)
在javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:455)
在javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
位于java.base/java.security.AccessController.doPrivileged(AccessController.java:389)
位于javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
位于javafx.graphics/com.sun.glass.ui.invokelateDispatcher$Future.run(invokelateDispatcher.java:96)
在javafx.graphics/com.sun.glass.ui.win.WinApplication.\u runLoop(本机方法)
位于javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
... 还有一个
运行应用程序main.AgentManager时出现异常
为什么会发生这种情况?我如何修复它?
我正在使用的框架可以在这个github上找到:
以下是运行程序的类:
package main;
import com.eudycontreras.othello.application.Othello;
import com.eudycontreras.othello.enumerations.BoardCellState;
import com.eudycontreras.othello.enumerations.PlayerTurn;
import com.eudycontreras.othello.models.GameBoardCell;
import javafx.application.Application;
import javafx.stage.Stage;
/**
* <H2>Created by</h2> Eudy Contreras
* <h4> Mozilla Public License 2.0 </h4>
* Licensed under the Mozilla Public License 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <a href="https://www.mozilla.org/en-US/MPL/2.0/">visit Mozilla Public Lincense Version 2.0</a>
* <H2>Class description</H2>
* Class which represents an AI agent which will produce a move
* Feel free to take a good look at the agent controller for additional
* helper methods, examples and methods for creating more complex AI agents.
*
* Feel also free to refer to the threading package for multi-threading and timer helpers
*
* <pre>
* Execute a task on a separate thread
*
* ThreadManager.execute(()->{
* Thing to do here
* });
*
* Execute a task and perform an action upon completion
*
* ThreadManager.execute(
* (success)-> {
* Task to perform
* },
* ()-> {
* Thing to do upon completion
* });
*</pre>
*
* @author Eudy Contreras
*
*/
public class AgentManager extends Application{
/**
* Application start method: Choose the agent
* you wish to use and run the program
*/
@Override
public void start(Stage primaryStage) throws Exception {
new Othello(primaryStage, new ExampleAgentOne("Agent A"), new ExampleAgentTwo("Agent B"));
//new Othello(primaryStage, new ExampleAgentB());
//new Othello(primaryStage, new ExampleAgentC());
//new Othello(primaryStage, new ExampleAgentD());
}
public static void main(String[] args) {
launch(args);
}
public static void printBoard(GameBoardCell[][] cells) {
printBoard(cells, false);
}
public static void printBoard(GameBoardCell[][] cells, boolean print) {
if(!print){
return;
}
System.out.println();
System.out.print(" ");
for (int row = 0; row < cells.length; row++) {
System.out.print(" "+row);
}
System.out.println();
for (int row = 0; row < cells.length; row++) {
System.out.println(" ---------------------------------");
System.out.print(row + " |");
for (int col = 0; col < cells[row].length; col++) {
if (cells[col][row].getCellState() != BoardCellState.EMPTY) {
System.out.print(" " + cells[col][row] + " |");
} else {
System.out.print(" " + " " + " |");
}
}
System.out.println("");
}
System.out.println(" ---------------------------------");
System.out.println();
}
}
packagemain;
导入com.eudycontreras.othello.application.othello;
导入com.eudycontreras.othello.enumerations.BoardCellState;
导入com.eudycontreras.othello.enumerations.PlayerTurn;
导入com.eudycontreras.othello.models.GameBoardCell;
导入javafx.application.application;
导入javafx.stage.stage;
/**
*尤迪·孔特雷拉斯创作
*Mozilla公共许可证2.0
*根据Mozilla公共许可证2.0(以下简称“许可证”)获得许可;
*除非遵守许可证,否则不得使用此文件。
*您可以通过以下方式获得许可证副本:
*
*类描述
*类,该类表示将生成移动的AI代理
*请随意查看代理控制器以了解更多信息
*用于创建更复杂AI代理的助手方法、示例和方法。
*
*也可以参考多线程和计时器帮助程序的线程包
*
*
*在单独的线程上执行任务
*
*ThreadManager.execute(()->{
*这里要做的事
* });
*
*执行任务并在完成后执行操作
*
*ThreadManager.execute(
*(成功)->{
*要执行的任务
* },
* ()-> {
*完工后要做的事
* });
*
*
*@作者尤迪·孔特雷拉斯
*
*/
公共类AgentManager扩展应用程序{
/**
*应用程序启动方法:选择代理
*您希望使用并运行该程序
*/
@凌驾
public void start(Stage primaryStage)引发异常{
新奥赛罗(初级阶段,新示例agenttone(“代理A”)、新示例agenttwo(“代理