Pergunta

I'm currently working on a project where I'm using the LWJGL library and I just tried building a .jar out of it all, now the problem is that nothing happens when I try to start the .jar.

My only thought is that maybe the library didn't export correctly but I've been looking around at the other questions here for a while and I've have added everything correctly at the Dependencies tab in the Project Structure, the libraries I need are also in the Artifact Output Layout as extracted directories.

I just tried checking the stacktrace with cmd and it says that it can't find lwjgl in the library path so I'm guessing there's something I don't know about .jar files or something that's causing this error.

Here's the stacktrace:

Also in IntelliJ I've put "-Djava.library.path=lib\native" in VM options, is it possible that this doesn't apply to the .jar or something.

Help is appreciated!

Foi útil?

Solução

There is a rather complicated process to make an executable jar with LWJGL. You need to use Jarsplice.

Jarsplice has 4 steps which are pretty self explanatory but here they are anyway:

1: Add Jars.

Add the jar you generated as well as all the libraries. That includes lwjgl.jar, and any other jars you used.

2: Add Natives.

Add all the natives you used in your project. These are the files you referenced using -Djava.library.path.

3: Main Class

Select the main class of your program. This could be something like com.example.game.EntryPoint.

4: Create Fat Jar

Click "Create Fat Jar" to create your executable jar!

You can also optionally create a Windows .exe, OSX .app, and Linux .sh executables as well.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top