我写了一些代码来从文件中加载纹理。它在 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
为什么这不起作用?