Call to com.jme3.system.lwjgl.LwjglTimer throws Exception when running distibution jar

import com.jme3.system.lwjgl.LwjglTimer;
public static LwjglTimer timer = new LwjglTimer();

for some reason my code runs fine in the SDK but when I build and clean my project: running the jar gives this error…

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.Sys$
at Method)
at org.lwjgl.Sys.doLoadLibrary(
at org.lwjgl.Sys.loadLibrary(
at org.lwjgl.Sys.(
at com.jme3.system.lwjgl.LwjglTimer.(
at testerPackage.Main.(

… this is a picture of the libraries i load.

I have never needed to use that class before. Why are you?

As an aside, the distribution may be using a different lwjgl version.

Isn’t com.jme3.system.Timer an abstract class? I found lwjgltimer to be the only child with a method to get time in seconds.

I use the timer in my project to get the current time in my simpleupdate loop and compare that to to the time of creation n of a certain type of static that can spawn to time a deletion after a certain amount of time.

Why would the dist be using a different version of lwjgl if the same libraries as the sdk are used during building?


Personally I would use an appstate and accumulate the time until it reached my limit. That would be the JME way.

private float accumulatedTime = 0;

public void update(float tpf) {
    accumulatedTime += tpf;

    if (accumulatedTime > 5) { // 5 seconds

I’m not saying it is - but if it found the class during the SDK run and didn’t in the DIST run - it just begs the question “whats the difference”.

Yeah this would definitely work.:+1: I just find it weird how the class if found while running from the SDK and not from the dist because to my knowledge there should be no difference.

It’s easy. You are not passing the correct class path.
Running from the SDK does that for you, but when you launch the jar, you need to specify all the libraries using -cp .
Some other tools pack all the libraries into the main jar, that’s probably why you don’t know that problem there.

I’ll look into that. Not to sound dumb but how do you specify a classpath for a JME build? The distribution runs when jme3.system.lwjgltimer is not included. The problem is specific to that error.

How are you building? Most build tools have a way to specify a classpath that is embedded in the .jar this will usually include paths to external jars relative to thelaunch location of the application.

If you move the compiled jar, you must also make sure that copies of all the required jars exist in the proper relative locations.