Hot questions for Using Lightweight Java Game Library in jvm


I can't find documentation for the VM argument -XstartOnFirstThread. Seems necessary for me to run JOGL through LWJGL on my Mac. What does it mean? It seems to be that some process wants thread 0. Is this correct?

Please note: I have a run() method in my main class. It doesn't seem to be overriding anything and I'm not implementing runnable.

Example source code I'm running here:


As of Java 1.7.0_u4, this option is documented in java -X on the Mac OSX platform.

The option causes the JVM to use thread 0 to start the application. Apparently this is necessary to get Mac OSX to run SWT and GWT apps properly. According to the Eclipse SWT FAQ, AWT and Swing apps use some undocumented magic to do this.


I'm working on a project that requires LWJGL and I'm trying to get the project up and running and have hit a road block in terms of getting the JVM Launch arguments set up.

The documentation for the LWJGL reads as follows:

Set the -Djava.library.path system property (as a JVM launch argument) to the folder containing your native files

The error I'm getting is:

Exception in thread "main" java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path
  at java.lang.ClassLoader.loadLibrary(
  at java.lang.Runtime.loadLibrary0(
  at java.lang.System.loadLibrary(
  at org.lwjgl.LWJGLUtil.loadLibrarySystem(
  at org.lwjgl.Sys$
  at Method)
  at org.lwjgl.Sys.<clinit>(
  at HelloWorld.main(

I've already added the LWJGL jar into the Properties -> Java Build Path -> Libraries.

I've done some queries to figure out how to set JVM Launch arguments, and am missing something clearly obvious. I'm new to build configurations with projects in Java. Any ideas? Thx.


After some helpful answers, I've added a system variable into my run configurations and am still getting the same error. Here is a screenshot of my Run Configurations.

Also, it may be important info that my lwjgl jar is located in my Project folder.


You can set system properties directly in your code so they work outside of eclipse.

public class Main {
    static {
        final String PATH_TO_NATIVES = /*...*/;
        System.setProperty("java.library.path", PATH_TO_NATIVES);

You should do this before any other actions, so put it inside a static block in your main class (like in the code above) or at the start of your main method.

By the way: You can also set org.lwjgl.librarypath instead, which is more specific (although both properties will work).

EDIT: As of 3.0.0b build 37 it is possible to set these properties at runtime with the new Configuration class.

public class Main {
    final String PATH_TO_NATIVES = /*...*/;


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?


You can set the properties inside your program. Use either

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



at the start of your main method.