Can't get lwjgl to work in NetBeans 6.5.1 (windows vista)

Started by wolfie, March 17, 2009, 16:22:56

Previous topic - Next topic


Hi! I added libraries in project window via add Libraries (\native\win32) but I keep getting package does not exist error (I tried to import org.lwjgl.*). What am I missing?


You don't add the natives as libraries.

1. Create a library with LWJGL jars.
- Tools > Libraries > New Library
- Name it LWJGL. Add the jars (lwjgl, jinput, lwgjl-util) in the classpath tab, the src directory in the source tab and the javadoc dir in the javadoc tab.
- Click ok and close the library manager.
2. Add the library to your project.
- Right-click project > properties > libraries > add library > LWJGL
3. Add java.library.path to run parameters.
- In the project properties under "run" put "-Djava.library.path=C:\lwjgl\native\win32" (or wherever your LWJGL dlls are, without the "") in the "VM Options" field.


Thank you! It works now. I didn't know i had to download the source. Somebody should write a guide about this.


Quote from: wolfie on March 17, 2009, 17:43:25
Thank you! It works now. I didn't know i had to download the source. Somebody should write a guide about this.

You don't need the source. It's just extremely helpful because it lets you the context menu options like "jump to declaration" and "jump to source". Javadoc isn't required either but, if given, Netbeans will display the relevant documentation, e.g. in the Strg+Space menu.

You only really need the .jars, as that's where the LWJGL classes are in; and that library path parameter so LWJGL finds the os specific native libraries during runtime.


Strange. I think I tried with the jars and VM options before but it didn't work. Must have forgotten something.


Quote from: padam1989 on September 16, 2009, 04:43:11
the steps are actually incomplete. here is the full steps to set up lwjgl with netbeans.

The steps on that site are partially redundant. They add jars directly to a project and as a library. Aside from being harder to maintain (e.g. upgrades) this adds lwjgl-util.jar twice, as well as both lwjgl.jar and lwjgl-debug.jar (which are, to my understanding, mutually exclusive) to the run and test classpath.


Now if someone knows a similar one to intelliJ 8.0 ? :(
Tried everything I can think of with pointing "-Djava.library.path", copied the .dll's to 101 places etc lol

Still no luck.. why do I always get stuck on THIS whenever I try some new library..


The path should be specified like:


or pointing to wherever you've located the libraries.

Note that you can't just copy the line above and alter it, for some strange reason you'll need to re-type the double qoutes in netbeans, or else it won't work. Netbeans uses another kind of double quotes, or something like that.

If you really can't get it to work this way, copy the natives to the project's working directory, by default the project's base directory. I really don't recommend this, as it gets messy really easy.
When I am king, they shall not have bread and shelter only, but also teachings out of books, for a full belly is little worth where the mind is starved - Mark Twain


maybe you specify a lib path with several paths, then Windows is different from the UNIX path such as java.library.path="C:\aPath\TO\Dll\;.\relative\path;" like a DOS PATH with ";" semi-colons.
unlike UNIX uses ":" colons.