运行 NetBeans 上的 EmojiOneJava
Running EmojiOneJava on NetBeans
当我尝试在 NetBeans 上 运行 来自 EmojiOneJava 的代码时,我总是 运行 出错。这是别人的代码,我想看看它是如何工作的。
我需要帮助 运行在 NetBeans 中或通过 GitBash(我使用的是 Windows 计算机)
Link 到 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$launchApplication5(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$launchApplication12(LauncherImpl.java:863)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait5(PlatformImpl.java:326)
at com.sun.javafx.application.PlatformImpl.lambda$null3(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater4(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$null8(WinApplication.java:191)
... 1 more
异常运行宁申请com.uz.emojione.fx.EmojiListExample
Java 结果:1
First:
将您的两个 FXML
文件及其控制器重构到 fx
文件夹中。对 emoji.json
和 Json.java
做同样的事情。将它们重构到 emojione
文件夹。
Second:
//The correct way to load and Image:
private String getEmojiImagePath(String hexStr)
{
String filePath = "resources/com/uz/emojione/fx/png_40/" + hexStr + ".png";
File file = new File(filePath);
return file.toURI().toString();
}
Third:
转到您的 src
文件夹并剪切 resources
文件夹。现在将 resources
文件夹粘贴到与 src
相同的文件夹中
Finally:
You will have to deploy the resources
folder in the same folder as your jar
to run this outside of Netbeans.
I notice that you also have this:
为了得到这个 运行 我必须做同样的事情来加载我在上面所做的图像。
当我尝试在 NetBeans 上 运行 来自 EmojiOneJava 的代码时,我总是 运行 出错。这是别人的代码,我想看看它是如何工作的。 我需要帮助 运行在 NetBeans 中或通过 GitBash(我使用的是 Windows 计算机)
Link 到 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$launchApplication5(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$launchApplication12(LauncherImpl.java:863)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait5(PlatformImpl.java:326)
at com.sun.javafx.application.PlatformImpl.lambda$null3(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater4(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$null8(WinApplication.java:191)
... 1 more
异常运行宁申请com.uz.emojione.fx.EmojiListExample Java 结果:1
First:
将您的两个 FXML
文件及其控制器重构到 fx
文件夹中。对 emoji.json
和 Json.java
做同样的事情。将它们重构到 emojione
文件夹。
Second:
//The correct way to load and Image:
private String getEmojiImagePath(String hexStr)
{
String filePath = "resources/com/uz/emojione/fx/png_40/" + hexStr + ".png";
File file = new File(filePath);
return file.toURI().toString();
}
Third:
转到您的 src
文件夹并剪切 resources
文件夹。现在将 resources
文件夹粘贴到与 src
Finally: You will have to deploy the
resources
folder in the same folder as yourjar
to run this outside of Netbeans.
I notice that you also have this:
为了得到这个 运行 我必须做同样的事情来加载我在上面所做的图像。