Search code examples
javaeclipsejvmlwjgl

How to set a JVM launch argument in Eclipse?


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(ClassLoader.java:1857)
  at java.lang.Runtime.loadLibrary0(Runtime.java:870)
  at java.lang.System.loadLibrary(System.java:1119)
  at org.lwjgl.LWJGLUtil.loadLibrarySystem(LWJGLUtil.java:337)
  at org.lwjgl.Sys$1.run(Sys.java:36)
  at java.security.AccessController.doPrivileged(Native Method)
  at org.lwjgl.Sys.<clinit>(Sys.java:33)
  at HelloWorld.run(HelloWorld.java:24)
  at HelloWorld.main(HelloWorld.java:114)

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.

Update

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.

enter image description here

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


Solution

  • Right click the mouse -> Run Configurations... ->Arguments.then do as the following screenshot.

    enter image description here

    Hope that helped.