Sealed library with LWJGL3?

Tried to upgrade, but got

Exception in thread "jME3 Main" java.lang.ExceptionInInitializerError
        at org.lwjgl.Sys.createImplementation(Sys.java:129)
        at org.lwjgl.Sys.<clinit>(Sys.java:116)
        at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.j
ava:210)
        at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.SecurityException: sealing violation: package org.lwjgl is
sealed
        at java.net.URLClassLoader.getAndVerifyPackage(Unknown Source)
        at java.net.URLClassLoader.definePackageInternal(Unknown Source)
        at java.net.URLClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.access$100(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at org.lwjgl.LWJGLUtil.loadIcon(LWJGLUtil.java:285)
        at org.lwjgl.LWJGLUtil.<clinit>(LWJGLUtil.java:259)
        ... 4 more

Then I checked the libs folder and I actually found lwjgl2.9.3.jar

My gradle looks like this

dependencies {
 
    compile "org.jmonkeyengine:jme3-core:$jmeVersion"
    compile "org.jmonkeyengine:jme3-desktop:$jmeVersion"
    //compile "org.jmonkeyengine:jme3-lwjgl:$jmeVersion"
    
    
    // LWJGL dependencies START
    compile "org.lwjgl:lwjgl:$lwjglVersion"
    compile "org.lwjgl:lwjgl-assimp:$lwjglVersion"
    compile "org.lwjgl:lwjgl-glfw:$lwjglVersion"
    compile "org.lwjgl:lwjgl-openal:$lwjglVersion"
    compile "org.lwjgl:lwjgl-opengl:$lwjglVersion"
    compile "org.lwjgl:lwjgl-stb:$lwjglVersion"
    compile "org.lwjgl:lwjgl:$lwjglVersion:$lwjglNatives"
    compile "org.lwjgl:lwjgl-assimp:$lwjglVersion:$lwjglNatives"
    compile "org.lwjgl:lwjgl-glfw:$lwjglVersion:$lwjglNatives"
    compile "org.lwjgl:lwjgl-openal:$lwjglVersion:$lwjglNatives"
    compile "org.lwjgl:lwjgl-opengl:$lwjglVersion:$lwjglNatives"
    compile "org.lwjgl:lwjgl-stb:$lwjglVersion:$lwjglNatives"
    // LWJGL dependencies END
    
    compile "org.jmonkeyengine:jme3-jogg:$jmeVersion"
    compile "org.jmonkeyengine:jme3-effects:$jmeVersion"
    compile 'com.simsilica:zay-es:1.2.1'
    compile 'com.simsilica:lemur:1.10.1'
    compile 'com.simsilica:lemur-proto:1.9.1'
    compile 'com.simsilica:lemur-props:1.0.1'
    compile 'com.simsilica:sio2:1.1.0'
    //compile 'com.simsilica:sim-math:1.1.1'
    compile 'com.google.guava:guava:19.0'
    compile 'net.java.dev.jna:jna:4.2.2'
    compile 'net.java.dev.jna:jna-platform:4.2.2'
    compile 'org.slf4j:slf4j-api:1.7.21'
    compile "${pesegato.g}:GoldMonkey:${pesegato.v}"
    compile "${pesegato.g}:GibbonDice:${pesegato.v}"
    compile "${pesegato.g}:BigBanana:${pesegato.v}"
    compile "${pesegato.g}:MonkeySheet:interruption-SNAPSHOT"

    compile files('../commons-math3-3.5.jar')
    compile files('../tonegod.emitter.jar')
    compile files('../tonegodgui-0.0.2.jar')
    compile files('../Mermaid.jar')
    
    runtime project(':assets')    
}

Please note that LWJGL2 is commented out.

I have 2 questions:

  1. why the above, and how to fix it?

  2. Since JME uses jInput for managing input, does this mean that upgrading to lwgjl3 won’t fix input-related bugs?

  1. Why the LWJGL is there on its own? Why don’t just
    compile “org.jmonkeyengine:jme3-lwjgl3:$jmeVersion”
    ?

  2. Maybe not, maybe it will, the inputs are still implemented differently. JMEs classes are just interfaces on top of these.

Thanks, did what you said but result is the same

dependencies {
 
    compile "org.jmonkeyengine:jme3-core:$jmeVersion"
    compile "org.jmonkeyengine:jme3-desktop:$jmeVersion"
    compile "org.jmonkeyengine:jme3-lwjgl3:$jmeVersion"
    
    /*
    // LWJGL dependencies START
    compile "org.lwjgl:lwjgl:$lwjglVersion"
    compile "org.lwjgl:lwjgl-assimp:$lwjglVersion"
    compile "org.lwjgl:lwjgl-glfw:$lwjglVersion"
    compile "org.lwjgl:lwjgl-openal:$lwjglVersion"
    compile "org.lwjgl:lwjgl-opengl:$lwjglVersion"
    compile "org.lwjgl:lwjgl-stb:$lwjglVersion"
    compile "org.lwjgl:lwjgl:$lwjglVersion:$lwjglNatives"
    compile "org.lwjgl:lwjgl-assimp:$lwjglVersion:$lwjglNatives"
    compile "org.lwjgl:lwjgl-glfw:$lwjglVersion:$lwjglNatives"
    compile "org.lwjgl:lwjgl-openal:$lwjglVersion:$lwjglNatives"
    compile "org.lwjgl:lwjgl-opengl:$lwjglVersion:$lwjglNatives"
    compile "org.lwjgl:lwjgl-stb:$lwjglVersion:$lwjglNatives"
    // LWJGL dependencies END
    */
    compile "org.jmonkeyengine:jme3-jogg:$jmeVersion"
    compile "org.jmonkeyengine:jme3-effects:$jmeVersion"
    compile 'com.simsilica:zay-es:1.2.1'
    compile 'com.simsilica:lemur:1.10.1'
    compile 'com.simsilica:lemur-proto:1.9.1'
    compile 'com.simsilica:lemur-props:1.0.1'
    compile 'com.simsilica:sio2:1.1.0'
    //compile 'com.simsilica:sim-math:1.1.1'
    compile 'com.google.guava:guava:19.0'
    compile 'net.java.dev.jna:jna:4.2.2'
    compile 'net.java.dev.jna:jna-platform:4.2.2'
    compile 'org.slf4j:slf4j-api:1.7.21'
    compile "${pesegato.g}:GoldMonkey:${pesegato.v}"
    compile "${pesegato.g}:GibbonDice:${pesegato.v}"
    compile "${pesegato.g}:BigBanana:${pesegato.v}"
    compile "${pesegato.g}:MonkeySheet:interruption-SNAPSHOT"

    compile files('../commons-math3-3.5.jar')
    compile files('../tonegod.emitter.jar')
    compile files('../tonegodgui-0.0.2.jar')
    compile files('../Mermaid.jar')
    
    runtime project(':assets')    
}

On my lib folder there’s
lwjgl2.9.3
lwjgl3.1.2

Well fug… Something is maybe dragging the version 2 still there. And things get messy. Did you try clean & build etc.?

This is maybe not much of a help, but our working LWJGL 3 Gradle build:

My game depends on my libraries, which in turn have

  runtime "${jme3.g}:jme3-lwjgl:${jme3.v}"

Could this be the issue?

I guess :slight_smile: Can you try to up those as well? I’m not really an expert on the matter. I know there was some command you can execute to see a tree of dependencies in Gradle. We had this problem once that pspeed’s SiO2 was getting newer version of JME core to our project and this tree lighted it up :slight_smile:

Good, now I have 36 errors because Display.getWidth() don’t exists…

The LWJGL migration guide don’t help either :frowning:

EDIT: It looks like now there’s a huge GLFW utility class

Those I replaced from our code with the usage of AppSettings. There you can get width & height. That was maybe the only thing that was needed. Now we can switch back and forth just by swapping out the library.

You are better of to use JME stuff, if the thing you need is by any means exposed there. GLFW might not be forever.

Running on the SDK, I get

GRAVE: CRITICAL ERROR: Context class is missing!
Make sure jme3_lwjgl-ogl is on the classpath.
java.lang.ClassNotFoundException: com.jme3.system.lwjgl.LwjglDisplay

Which isn’t even available. So lwjgl3 mandates gradle?

Dunno man… I’m using the latest JME SDK version. But all my stuff is using Gradle. The SDK itself for me reports always:

Running on jMonkeyEngine 3.2-stable
 * Branch: HEAD
 * Git Hash: f85624a
 * Build Date: 2018-04-17
LWJGL 2.9.3 context running on thread jME3 Main

Thanks! Managed to make it work :slight_smile:

Now:
how to get current lwjgl version from code?
Is it possible to get driver version from lwjgl3 or GLFW?

After some brief testing, I had mixed feelings:

On the plus side lwjgl3 can tell the difference between “Enter” and “Numpad Enter”, where lwjgl2 cannot
On the minus side I had some inconveniences with BigBanana, most likely the library behaves a bit differently.

After some further tests, I realized that lwjgl3 breaks BigBanana… oh well I’ll revert back to lwjgl2 :expressionless:

LWJGL 3 is the future! Join the cult! :slight_smile:

Well, anyway, if there were some bugs on the JME LWJGL 3 side, please report them.

1 Like

First, I get a lot of warning for a virtual device that now is not connected; but this is minor

WARN c.simsilica.lemur.input.InputMapper - No button mapping for:JoystickButton[name=17, parent=vJoy Device, id=17, logicalId=17]

Most notably, Input remapping is unusable BigBanana/RemapInputAppState.java at master · Pesegato/BigBanana · GitHub

If you do gradle run and try to change input, on LWJGL2 you can click on a button and change the mapping.
On LWJGL3 the button gets the event and register the mouse for everything. It’s not possible to register any other input.

1 Like