0

我写了一些代码来从文件中加载纹理。它在 Windows 机器上运行良好,但是一旦我把它送回家在 OSX 上工作,它就一直崩溃。这是一段简单的代码:

String path = System.getProperty("user.dir") + File.separator + "textures"
            + File.separator;
File file = new File(path + "steel.jpg");

try {
    shipTexture = TextureIO.newTexture(file , true);
} catch {GLException e) {
} catch {IOException e) {
}

我得到以下异常:线程“main”中的异常 java.lang.NoClassDefFoundError: com/sun/gluegen/runtime/DynamicLookupHelper

在纹理初始化阶段,

原因:java.lang.ClassNotFoundException: com.sun.gluegen.runtime.DynamicLookupHelper at java.net.URLClassLoader$1.run

为什么这不起作用?

4

1 回答 1

1

AclassNotFoundException通常与您的代码没有太大关系,这意味着您的类不在类路径中,这可能是因为您的编辑器没有找到它 -

http://www.wikihow.com/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29

或者因为您在 windows 和 mac 中的目录结构不同 -

http://www.ibm.com/developerworks/library/j-classpath-unix/

尝试删除包并将其再次添加到您的类路径

于 2012-07-05T08:29:47.200 回答