LWJGL - Lightweigt Java Game Library

Installation

As LWJGL is more or less self contained, the actual installation typically amounts to extracting the archive, and asserting that everything works fine by running an example. The following paragraphs will walk you through the installation on the supported platforms: Windows, Linux and Mac OS X.

Below the installations instructions you will find help on how to integrate LWJGL into Eclipse, Netbeans and JCreator.

Windows Back to top

  • Download the distribution
  • Unpack the archive, file contents (in sub folders) should include (amongst other things):

    lwjgl.dll
    lwjglaudio.dll
    lwjgl.jar
    lwjgl_util.jar
    lwjgl_test.jar
  • Test LWJGL by opening a command prompt, and navigating to the folder where the archive was extracted. Once navigated, issue the following command: (all in one line, space before each -option)

    java -cp .;res;jar\lwjgl.jar;jar\lwjgl_test.jar;jar\lwjgl_util.jar;jar\lwjgl_fmod3.jar;jar\lwjgl_devil.jar;jar\jinput.jar; 
        -Djava.library.path=native\windows org.lwjgl.test.WindowCreationTest
    A window should appear and you should see the following output:

    Found <number> display modes
    240, 320, WindowCreationTest
    Display created
    Moving to 100, 100
    Window created
    600, 800, Game

Linux Back to top

  • Download the distribution
  • Unpack the archive, file contents (in sub folders) should include (amongst other things):

    liblwjgl.so
    libopenal.so
    lwjgl.jar
    lwjgl_util.jar
    lwjgl_test.jar
  • Test LWJGL by opening a command prompt, and navigating to the folder where the archive was extracted. Once navigated, issue the following command: (all in one line, space before each -option)

    java -cp .:res:jar/lwjgl.jar:jar/lwjgl_test.jar:jar/lwjgl_util.jar:jar/lwjgl_fmod3.jar:jar/lwjgl_devil.jar:jar/jinput.jar: 
        -Djava.library.path=native/linux org.lwjgl.test.WindowCreationTest
    Should library loading fail, try using -Djava.library.path to specify the path. For example:

    java -cp .:res:jar/lwjgl.jar:jar/lwjgl_test.jar:jar/lwjgl_util.jar:jar/lwjgl_fmod3.jar:jar/lwjgl_devil.jar:jar/jinput.jar: 
        -Djava.library.path=/home/lwjgluser/lwjgl/ org.lwjgl.test.WindowCreationTest
    A window should appear and you should see the following output:

    Found <number> display modes
    240, 320, WindowCreationTest
    Display created
    Moving to 100, 100
    Window created
    600, 800, Game

Mac OS X Back to top

  • Download the distribution
  • Unpack the archive, file contents (in sub folders) should include (amongst other things):

    liblwjgl.jnilib
    openal.dylib
    lwjgl.jar
    lwjgl_util.jar
    lwjgl_test.jar
  • Test LWJGL by opening a command prompt, and navigating to the folder where the archive was extracted. Once navigated, issue the following command: (all in one line, space before each -option)

    java -cp .:res:jar/lwjgl.jar:jar/lwjgl_test.jar:jar/lwjgl_util.jar:jar/lwjgl_fmod3.jar:jar/lwjgl_devil.jar:jar/jinput.jar: 
    	 -Djava.library.path=native/macosx org.lwjgl.test.WindowCreationTest
    A window should appear and you should see the following output:

    Found <number> display modes
    240, 320, WindowCreationTest
    Display created
    Moving to 100, 100
    Window created
    600, 800, Game

Installation

Using LWJGL in your IDE is as as simple as including the jar and telling where the native files are to be located. The following lists how to install LWJGL in some popular IDEs: Eclipse, Netbeans, JCreator.

Eclipse Back to top

  • Having installed LWJGL on your platform of choice, fire up Eclipse.
  • Create a new project, and add lwjgl.jar to the build path of your project (Project->Properties->Java build path) by clicking 'Add External JARs' under the Libraries tab

    LWJGL Installation under Eclipse

  • Having created a class to run, create a new run target by selecting the 'Run' icon or using the menu (Run -> Run...)

    LWJGL Installation under Eclipse

    Select 'New' from the dialog box

    LWJGL Installation under Eclipse

    Supply a name for your new target, and make SURE you add the path to the dll files supplying the -Djava.library.path argument to the vm. The path you supply is relative to the working directory. Adjust this too if needed.

    LWJGL Installation under Eclipse

  • You should now be able to run the application directly from Eclipse. Run the newly created target to confirm.

Netbeans Back to top
Please read the install guide in the wiki: How to set up Netbeans 5.5 for use with LWJGL

JCreator Back to top

  • Create project. Goto Project->Project Properties, select 'Required Libraries' tab and click New.

    LWJGL Installation under JCreator

  • Call new library collection LWJGL. Click add->path and add the path to where you installed lwjgl. Then click add->Archive and select the 2 .jar files.

    LWJGL Installation under JCreator

  • Make sure the LWJGL library is ticked.

    LWJGL Installation under JCreator

 
content © by lwjgl.org - design © by Daniel Leinich