你能帮我解决这个问题吗?
Exception in thread "main" com.jme3.asset.AssetNotFoundException: Interface/splash.png
at com.jme3.system.JmeDesktopSystem.showSettingsDialog(JmeDesktopSystem.java:112)
at com.jme3.system.JmeSystem.showSettingsDialog(JmeSystem.java:128)
at com.jme3.app.SimpleApplication.start(SimpleApplication.java:125)
at adventure.Q3World.main(Q3World.java:85)
它曾经有效,然后我不得不重新打包所有东西,现在我可能忘记了 Eclipse 中的设置或类似的设置。启动文件在那里,但它不在某个路径上。
我想做的是这个,它在我以前的构建中有效:
settings.setSettingsDialogImage("Interface/splash.png");
我也试过将路径添加到资源面板,但没有其他效果:
在 Java 构建路径中,列出了资源,但仍然无法正常工作:
我想要工作的更大的代码块是在构建的 jar 中工作但不在 eclipse juno 中工作的代码块是:
public static void main(String[] args) {
File file = new File("quake3level.zip");
if (!file.exists()) {
useHttp = true;
}
Q3World app = new Q3World();
AppSettings settings = new AppSettings(true);
settings.setTitle("Dungeon World");
settings.setSettingsDialogImage("Interface/splash.png");
app.setSettings(settings);
app.start();
}
成功
最佳答案
您能告诉我们您如何运行您的代码(例如,命令行,如果是,类路径是什么),以及 splash.png 的所有位置在您的文件夹结构中的什么位置?
该文件需要位于类路径中,因为它似乎来自此代码加载图像的位置。
String iconPath = sourceSettings.getSettingsDialogImage();
if(iconPath == null){
iconPath = "";
}
final URL iconUrl = JmeSystem.class.getResource(iconPath.startsWith("/") ? iconPath : "/" + iconPath);
if (iconUrl == null) {
// *****LINE 112 below*****
throw new AssetNotFoundException(sourceSettings.getSettingsDialogImage());
}
关于java - 我无法理解的小 Java 异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16118726/