Syd Lambert
Syd Lambert

Reputation: 1495

Java - Run a jar with VM arguments without commandline

I currently have a jar that needs the -Djava.library.path to be set for LWJGL on launch or it will throw an UnsatisfiedLinkError. To negate this problem, I have launched the jar through CMD with that VM argument using a batch file (Windows).

My question is - is there any way to do this natively in the jar without requiring some kind of launcher?

Upvotes: 1

Views: 403

Answers (1)

javac
javac

Reputation: 2441

You can set the properties inside your program. Use either

System.setProperty("org.lwjgl.librarypath", "path/to/natives");

or

Configuration.LIBRARY_PATH.set("path/to/natives");

at the start of your main method.

Upvotes: 1

Related Questions