LWJGL Linking Libraries

I am a little confused on why this isn’t working but I am trying to get LWJGL to work along side my own library but when I try to use my library which used the LWJGL I always get this error message

Exception in thread "main" java.lang.NoClassDefFoundError: org/lwjgl/LWJGLException
	at easycliptest.EasyClipTest.<init>(EasyClipTest.java:18)
	at easycliptest.EasyClipTest.main(EasyClipTest.java:67)
Caused by: java.lang.ClassNotFoundException: org.lwjgl.LWJGLException
	at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
	... 2 more
Java Result: 1

The thing about it though is LWJGL works if I just run the a test within the library project Easy Clip that uses LWJGL. If another program is to use Easy Clip as a library and easy clip uses LWJGL, then how can this be done?

Also not sure where this topic goes, I tried registering for LWJGL forums but this question “What is the package + class name that Display inherits from?”, is the one I am stuck on. In my opinion that forum has too many security requirements during registration. Seems too much to me.

[quote=“ECJava,post:1,topic:41286”]
Hehe; if you are stuck on this basic Object-Oriented programming question then you will probably have a hard time grasping something as complex as game development with LWJGL. :slight_smile: LWJGL is not exactly a beginner-friendly way to make games.

Regarding your problem, if you are developing a library that depends on LWJGL then it will need to be included as a dependency alongside your other projects. The LWJGL jars and natives need to be correctly included in your class-path, otherwise you will get the error you posted.

Some links:
http://www.lwjgl.org/wiki/index.php?title=Setting_Up_LWJGL_with_Eclipse

Thanks for making me feel stupid, if it’s so basic why don’t I know it? Not much of this stuff is taught or spoken of.

I’m also using netbeans 7.3 and it’s been kind of a pain to deal with

There is also a guide for NetBeans:
http://www.lwjgl.org/wiki/index.php?title=Setting_Up_LWJGL_with_NetBeans

You can find out what class an object extends (i.e. inherits from) by reading its JavaDoc:
http://lwjgl.org/javadoc/org/lwjgl/opengl/Display.html

Read more about it here:
http://www.ntu.edu.sg/home/ehchua/programming/java/J3c_OOPWrappingUp.html#zz-10.5

Well the thing is I already know all this. But it still doesn’t work. I’ve tried the class path and I’ve used the VM Options and placed all the right JARs in their own library in netbeans but I still get the error.

I think I understand your problem, I had a similar problem under Eclipse, I had to modify my project so that the JARs of my third party libraries become visible outside my project, I used the parameter “exported”, I set it to “true”. I’m under Netbeans 7.2.1 too, maybe I can find a similar solution for it.

Edit.: Adding LWJGL as a compile-time library into your “ECJava” project should work, no additional step should be necessary.