I did it! Bundling LWJGL and natives into a single jar...

Started by potatino, May 23, 2013, 13:52:38

Previous topic - Next topic

potatino

... from command-line (invoking JarSplice).

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

https://github.com/lquesada/JarSpliceCLI

Cornix

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?

potatino

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.

Cornix

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);