Eclipse: Aboriginal JAR packaging

I created a Java game using LWJGL that requires some native files. Everything works fine in Eclipse. I want to include dll files in a jar file, but every time I try, LWJGL cannot find the natives. I have already tried using jarsplice or fatjar, but to no avail. I know that minecraft is also programmed using LWJGL, and somehow it manages to load the natives from another folder.

Is there a way to pack my own files in a JAR file and allow a third-party library like LWJGL to access them? If not, how would I approach downloading them from an external folder?

EDIT: Somehow he worked with the natives in the same directory as the JAR file. I would still like to get some explanation and maybe some other methods.

+4
source share
1 answer

I just ran into this a few weeks ago. Alas, I have no links, but I found that you cannot link to your own files stored inside the jar file. You must either programmatically extract them before referencing them, or you must install them along with the jar file.

I went with the second option and just Eclipse packed the entire collection in a zip file for distribution.

For the first option, one place to look is the source code for JNA. They send dll / binaries inside their jar file and retrieve it on request.

+2
source

All Articles