Search code examples
javaeclipsereferencedependencieslwjgl

Eclipse wont resolve LWJGL reference (.jar)


This is related to (Attach the Source in Eclipse of a jar)

I'm trying to use the LWJGL libraries (specifically org.lwjgl.opengl.jar).

The problem is that the import (import org.lwjgl.opengl.Display) will not resolve properly:

the import org cannot be resolved

. On trying to open the classes in org.jwlg.opengl under "Referenced Libraries", I find:

Source not found

The source attachment does not contain the source for the file XXX

I added the opengl.jar by doing this:

Right click on the project->BuildPath->Configure Build Path->Libraries->Add External Jars

Here is everything I have tried to fix:

  • Removed the reference and re-added it

  • Cleaned the project (Project > clean). (didn't work)

  • I tried using Java Source Attacher (https://marketplace.eclipse.org/content/java-source-attacher) but it isn't compatible with my version of Eclipse

  • Imported the org.lwjgl.opengl.jar file as a project and attaching it to the reference as the source, but it hasn't worked.

I have been downloading the library from https://www.lwjgl.org/customize

This is a possible solution but I don't understand the answer at all, could someone explain? LWJGL jar not accesable


Solution

  • org.lwjgl.opengl.Display is from LWJGL 2, you downloaded LWJGL 3. See the guide: https://www.lwjgl.org/guide for its replacement.