Install LWJGL

Started by Pecose, April 30, 2020, 11:38:19

Previous topic - Next topic

Pecose

Hello everybody
I would like to know how to create a project on ECLIPSE from the LWJGL source code.
Thank you for your help.


Pecose

Thanks but that doesn't answer my question.
What is explained is how to install LWJGL.
I need that there is no ".jar"
I only want in my project the source code.
I downloaded "lwjgl-source-2.9.1" but once in my project I have lots of errors on "import"

KaiHH

You should first familiarize yourself with how to work with third-party libraries in a Java project. You don't copy&paste or otherwise "include" the source code of a third-party library into your project. You rather add their already built class jar file(s) to your classpath (Eclipse's build path) and then you attach their provided sources jar (as an Eclipse "Source Attachment") so that you can navigate the sources while working on your project.
But first: Is your project using the very old and outdated legacy LWJGL 2.x version or are you using LWJGL 3?

Pecose

I have no preference for the version.
In fact, I only managed to install version 2.9.1.

My project is to simplify the installation and use of LWJGL.
Put everything in a ".jar" and make the construction of the future project easier.

Unless you have a solution to embed ".jar" in ".jar", I have to work directly with the source code.

KaiHH

The most recommended and by far easiest approach to include LWJGL into your own project is simply by using a Java build and dependency management system, like Maven or Gradle. Period. Trying to make things simpler by wrapping LWJGL libraries into another jar (which you can do by simply flattening the jars - which are zip files only - into a single jar/zip file) is trying to attack the whole problem from the wrong side.
Dependency management systems like Maven and Gradle also have the added benefit of being IDE-agnostic. You can work with them in IntelliJ IDEA, NetBeans, Eclipse or any other Java IDE of your likings.
Every IDE supports Maven and Gradle out of the box and you can simply generate a build file description from the LWJGL website ( https://www.lwjgl.org/customize ), by selecting the modules you want to have (OpenGL, OpenAL, OpenCL, Vulkan, GLFW, ...) and have your project setup ready by a single click of a single button in your IDE once you simply copy&paste the LWJGL-provided build system description.
If you try to simplify the distributable artifacts or deployment of a LWJGL application, then again, there are better ways to do this, such as Maven's Shade Plugin or Gradles Shadow Plugin, to build a single uber-jar of your application and all of its dependencies.
Trying to come up with another approach to solve such problems is just ignoring existing and for the last two decades well-established solutions in the Java tooling ecosystem.
So, you should really consider working through the provided lwjgl3-wiki page once more and look at the available options.

Pecose

Ok thanks for your help