In Eclipse, my exported executable jar does nothing! (LWJGL)

Java beginner here.

I made a small java application in Eclipse (on Windows) using the LWJGL lib and Slick. Then, when I export the executable .jar file and run the resulting .jar, it does nothing. There are no errors, there is nothing - it just does not work. I follow this guide: http://www.cs.bsu.edu/homepages/pvg/misc/slick_eclipse_tutorial.php

This is what my manifest.mf file looks like:

Manifest-Version: 1.0 Main-Class: SimpleTest Class-Path: lib/lwjgl.jar lib/slick.jar 

Applications that do not use LWJGL export are just fine. What am I doing wrong?

I tried using JarSplice, which did not work, although I could abuse it. Any pointers?

+4
source share
3 answers

It is best that you skip the link to the Main-class in the manifest file.

See this , it shows how to properly configure your manifest file.

Enjoy!

EDIT:

 Manifest-Version: 1.0 Main-Class: SimpleTest Class-Path: lib/lwjgl.jar lib/slick.jar <-- new line without any content --> 

EDIT 2:

OK, I was able to reproduce this behavior. As I tried to run the exported jar through the console, I got the following exception:

 Exception in thread "main" java.lang.reflect.InvocationTargetException ... Caused by: java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path ... ... 5 more 

After several studies, I found out that it is hardly possible to pack a native dll into an executable jar.
To clarify, I found three options:

  • Just export your jar as a Runnable JAR in Eclipse and after that place it in the folder containing the native DLL (checked this, worked for my installation using your tutorial).
  • When executed, unzip your dll into a temporary directory, as indicated here
  • Or use the One-Jar project, which allows you to create running banks with native libraries

Hope this solved your problem. Hurrah!

+5
source

I have similar problems with eclipse and Slick, and here is what I found. (pulled from the LWJGL wiki )

I keep getting java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path

This is due to the fact that the native part is not configured correctly. Add a -Djava.library.path = path / to / dir to the command line or as a VM option in your IDE so that lwjgl can find the folder containing its own files.

In short, there are no suitable natives on the exported bank

Now that you are compiling the executable jar, I assume that you need a double-click application style to run, so this is not entirely possible.

you can set java.library.path after starting using System.setProperty or put the desired natives in the default default path.

I did not find the best solution, but hopefully it helped

+3
source

Try using the Jar Splice http://ninjacave.com/jarsplice All you have to do is provide all of your .jar files (core and libraries) and all of your DLLs. It can create a .jar that works. It can also execute an executable file (.exe), as well as Linux and Mac equivalents.

0
source

Source: https://habr.com/ru/post/1400173/


All Articles