【发布时间】:2017-11-28 15:59:34
【问题描述】:
当我尝试在 NetBeans 上运行来自 EmojiOneJava 的代码时,我一直遇到错误。这是别人的代码,我想看看它是如何工作的。 我需要帮助在 NetBeans 中或通过 GitBash 运行此代码(我使用的是 Windows 计算机)
GitHub 存储库链接:https://github.com/UltimateZero/EmojiOneJava
我遇到的错误示例:
Exception in Application start method
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:389)
at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
Caused by: java.lang.RuntimeException: Exception in Application start method
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:917)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$155(LauncherImpl.java:182)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalStateException: Location is not set.
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2434)
at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2409)
at com.uz.emojione.fx.EmojiListExample.start(EmojiListExample.java:24)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$162(LauncherImpl.java:863)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$175(PlatformImpl.java:326)
at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191)
... 1 more
异常运行应用程序 com.uz.emojione.fx.EmojiListExample Java 结果:1
【问题讨论】:
-
该错误表示
FXMLLoader找不到 FMXL 文件。构建应用程序时可能没有部署 FXML。确保将资源文件夹配置为构建文件夹(我不是 NetBeans 用户;我不知道在 NetBeans 中是如何配置的......)。 -
他改变了他的文件结构。他的
FXML文件位于文件夹名称resources中。 -
如果您按照我下面的说明进行操作,您的代码将运行。我让它运行。你还是有问题。您尝试加载图像,但您的图像路径不正确。就像您指向
FXML文件的路径一样。
标签: java javafx emoji emojione