Exporting a jar from eclipse

Hi guys,

I’m trying to build a game using jME (Bet you’ve never heard that before :)), and because I think eclipse is a pretty good editor, I went along and followed the tutorial on how to set up jME with eclipse. I ran some of the tests and, cool, they worked!

The next thing to do is offcource, try and show the program to someone else. So, i exported a .jar, doubleclicked it, and… nothing. If i can’t export a runnable file, then i can’t show off my program! :stuck_out_tongue:

So, next step, back to the console! java -jar file.jar, that command actually shows me an error message, a missing link on the LWGJ library.

Next stop, these forums. After reading, I think my problems have to do something about a classpath. A lot of topics talk about setting a classpath, but i can’t find a option named like that in eclipse. Is that the build path? If so, here is a screenshot of my current buildpath:

I’m reasonably familiar with eclipse, but pretty new to the library story. Can someone tell me what kind of options to check?


The question you're looking for is:

Q. It

Ah, it seems we've been promoted to a new error;

java.lang.NoClassDefFoundError: org/lwjgl/LWJGLException
        at com.jme.app.AbstractGame.getAttributes(AbstractGame.java:191)
        at com.jme.app.BaseGame.start(BaseGame.java:49)
        at goo.main(goo.java:46)
2-jul-2007 10:21:44 com.jme.app.BaseSimpleGame cleanup
INFO: Cleaning up resources.
Exception in thread "main" java.lang.NoClassDefFoundError: org/lwjgl/LWJGLExcept
        at com.jme.system.lwjgl.LWJGLSystemProvider.getDisplaySystem(LWJGLSystem
        at com.jme.system.DisplaySystem.getDisplaySystem(DisplaySystem.java:236)

        at com.jme.util.TextureManager.doTextureCleanup(TextureManager.java:583)

        at com.jme.app.BaseSimpleGame.cleanup(BaseSimpleGame.java:549)
        at goo.cleanup(goo.java:50)
        at com.jme.app.BaseGame.start(BaseGame.java:81)
        at goo.main(goo.java:46)

It doesn't matter whether I put in the extra options in the command line or not, I only get this error now.

After some searching, I found this topic, it seems to be about the same issue, the response there is:
llama said:

Maybe you put a lwjgl on your projects build path that is incompatible with the lwjgl on the jME build path?
You can put lwjgl on your projects classpath (if you need to do lwjgl calls directly, else it's not needed) but if you do it's easiest to just point to the exact same jar (the one in the jme project).

In any case it's not a library path issue (library path refers to the location of native libraries, such as dlls on windows).

So, its not a library path issue :?

I run the game with this line now:
java -Djava.library.path=E:lib -cp e:liblwjgl.jar -jar Goo.jar

The .jar file is now simply in e:, and i copied the library dir of the jME project to e:lib. Doesn't even seem to matter what I do, just get the same error over and over again :(

Try adding jme.jar to the classpath too.  You may also need jme-awt.jar.