user1503242
user1503242

Reputation: 1

Error loading texture from file in Java

I wrote some code to load textures from files. It works nicely on windows machines, but once I sent it home to work on OSX, it keeps crashing. This is a simple bit of code:

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) {
}

I get the following exception: Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/gluegen/runtime/DynamicLookupHelper

at the texture init stage,

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

Why is this not working?

Upvotes: 0

Views: 297

Answers (1)

zimZille
zimZille

Reputation: 267

A classNotFoundException usually doesn't have much to do with your code, it means your class isn't in the classpath this can be because your editor doesn't find it -

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

Or because you directory structure is different in windows and mac -

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

try removing the package and adding it again to you classpath

Upvotes: 1

Related Questions