1

I'm working on a game that uses LWJGL and thus requires native libraries specific to each platform. On this page, the author shows how to use the <nativelib> tag with Java Webstart to include JARs containing the appropriate native libraries. I'm trying to do something similar, but without using Webstart.

I tried adding the native library JARs to my main executable JAR's classpath, but that didn't work. Currently, the native libraries just sit in the same directory as the main JAR and that works fine, but I'd like to make it a bit tidier.

JoshDM
  • 4,939
  • 7
  • 43
  • 72
Jake
  • 600
  • 8
  • 20

2 Answers2

1

You have to use the JVM argument -Djava.library.path=/path/to/libs

Tomas Narros
  • 13,390
  • 2
  • 40
  • 56
0

Generate your jar, then add a script containing something like the following:

#!/bin/bash
java -Djava.libraray.path=. -jar your.jar

Asserting that the native libs are placed in the same folder as your application jar file.

Ortwin Angermeier
  • 5,957
  • 2
  • 34
  • 34