LWJGL Forum

Please login or register.

Login with username, password and session length

Author Topic: Include everything in a jar  (Read 4492 times)

@

  • Newbie
  • *
  • Offline Offline
  • Posts: 41
Include everything in a jar
« on: October 13, 2013, 11:05:58 »

I'm looking for ways to include in one jar the lwjgl lib along its natives, so wherever i include this jar, the project runs under any so (at least in desktops). The wiki only explains the process for one SO, should i deploy a new jar for every SO? if i recall properly, libGDX lets you deploy in every SO.
Logged

kappa

  • Administrator
  • Nerdus Imperius
  • *****
  • Offline Offline
  • Posts: 1305
Re: Include everything in a jar
« Reply #1 on: October 13, 2013, 15:19:39 »

have a look at JarSplice, it allows you to include everything in a jar.
Logged

@

  • Newbie
  • *
  • Offline Offline
  • Posts: 41
Re: Include everything in a jar
« Reply #2 on: October 13, 2013, 17:25:18 »

The tool comes in handy, but i'd rather know the process. Also, i prefer to set up eclipse (if possible) to save time, instead of using the tool everytime i want to deploy.
Logged

@

  • Newbie
  • *
  • Offline Offline
  • Posts: 41
Re: Include everything in a jar
« Reply #3 on: October 15, 2013, 13:19:20 »

I found a nice solution based on this blog post. For those interested, code is here and is used like this:

Code: [Select]
NativeUtils.deleteOldDir();

final File parent = NativeUtils.createTempDir();

NativeUtils.loadLibraryFromJar(parent, "/natives/lwjgl.dll"); //For each library you need to add a new line like this.

System.setProperty("org.lwjgl.librarypath", parent.getAbsolutePath());
Logged

NateS

  • Regular nerd
  • **
  • Offline Offline
  • Posts: 91
Logged