LWJGL Forum

Programming => Lightweight Java Gaming Library => Topic started by: potatino on May 23, 2013, 13:52:38

Title: I did it! Bundling LWJGL and natives into a single jar...
Post by: potatino on May 23, 2013, 13:52:38
... from command-line (invoking JarSplice).

I uploaded my wrapper to github for anyone who (as I did) needs it.

https://github.com/lquesada/JarSpliceCLI
Title: Re: I did it! Bundling LWJGL and natives into a single jar...
Post by: Cornix on May 23, 2013, 17:51:16
Why exactly do you want to put them into the jar? Wouldnt it be easier to put them in some kind of folder where you can easily change them for a newer version of lwjgl if there will ever be one released?
Title: Re: I did it! Bundling LWJGL and natives into a single jar...
Post by: potatino on May 24, 2013, 17:30:43
Cornix: that makes sense in just some cases.

In my case, I want my jar to be runnable in any of the main operating systems without the user needing to care about updates or -Djava.library.path-like parameters. Also, distributing a single bundled jar is more confortable than distributing a zip with the jar and some libraries and some natives and maybe some .bat and .sh's for the distinct operating systems.
Title: Re: I did it! Bundling LWJGL and natives into a single jar...
Post by: Cornix on May 24, 2013, 17:42:48
Quote[...] -Djava.library.path-like parameters. Also, distributing a single bundled jar is more confortable than distributing a zip with the jar and some libraries and some natives and maybe some .bat and .sh's for the distinct operating systems.
You can set the library path in your code, for example in your main method before any lwjgl-methods are used. Then you can have the libraries in a separate folder without the need to start with command prompt, .bat or .sh.


System.setProperty("java.library.path", "Some/Folder/");
final Field sysPathsField = ClassLoader.class.getDeclaredField("sys_paths");
sysPathsField.setAccessible(true);
sysPathsField.set(null, null);