3

你能帮我解决这个问题吗?

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();
    }

成功

在此处输入图像描述

4

1 回答 1

1

Can you tell us how you run your code (e.g. command line, if so, what is the classpath), and where all the locations of splash.png are in your folder structure?

The file needs to be on the classpath, as that appears to be from where this code loads the image.

http://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/desktop/com/jme3/system/JmeDesktopSystem.java?spec=svn10038&r=10038#112

    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());
    }
于 2013-04-20T09:39:30.347 回答