Setting up an application without the JMonkey SDK

Hey folks,

Recently I compiled the JMonkey Engine from source, however, I’m having trouble setting up an application, since the SDK is now in another branch.

I have included what I believe are all the libraries needed for JMonkey Engine to work, however, I get this error:

Exception in thread "main" java.lang.NoClassDefFoundError: org/lwjgl/opengl/GLDebugMessageARBCallbackI
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at com.jme3.system.JmeDesktopSystem.newContextLwjgl(JmeDesktopSystem.java:199)
at com.jme3.system.JmeDesktopSystem.newContext(JmeDesktopSystem.java:279)
at com.jme3.system.JmeSystem.newContext(JmeSystem.java:162)
at com.jme3.app.LegacyApplication.start(LegacyApplication.java:461)
at com.jme3.app.LegacyApplication.start(LegacyApplication.java:424)
at com.jme3.app.SimpleApplication.start(SimpleApplication.java:125)
at jmonkeytest.JMonkeyTest.main(JMonkeyTest.java:21)

Now I do realize that error is caused by some class which is not referenced on runtime, however I can’t seem to solve it. I tried adding the raw LWJGL .jar on the project however the error persist.

What are the libraries that you believe are “all” of them? Are you using gradle?

Here is my build file - note the dependencies. Not all of them are required, but i believe core, lwjgl and desktop are the minimum you need.

group 'com.jayfella'
version '1.0'

apply plugin: 'java'

apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'application'

mainClassName = 'com.jayfella.animalia.Main'

repositories {
    // mavenCentral()
    jcenter()
}



ext.jmeVersion = "[3.1,)"

dependencies {
    compile "org.jmonkeyengine:jme3-core:$jmeVersion"
    compile "org.jmonkeyengine:jme3-lwjgl:$jmeVersion"
    compile "org.jmonkeyengine:jme3-desktop:$jmeVersion"
    compile "org.jmonkeyengine:jme3-jogg:$jmeVersion"
    compile "org.jmonkeyengine:jme3-effects:$jmeVersion"
    compile "org.jmonkeyengine:jme3-plugins:$jmeVersion"
    // compile "org.jmonkeyengine:jme3-mesh:$jmeVersion"

    compile 'org.codehaus.groovy:groovy-all:2.4.7'
    compile "com.simsilica:lemur:[1.9,)"
    compile "com.simsilica:lemur-proto:[1.8,)"

    // compile project(':assets')
}

Would you consider using this?

@jayfella
What are the libraries that you believe are “all” of them? Are you using gradle?

Here is my build file - note the dependencies. Not all of them are required, but i believe core, lwjgl and desktop are the minimum you need.

By all I mean all the libraries starting with jme3 (e.x jm3-core, jm3-jbullet, etc), and I’m using Netbeans and including the libraries using “Project → Properties → Add Libraries”.

I managed to get the app settings popup window to show up, however right when the render window shows up, the error happens.

@nehon
Would you consider using this?

Hmm, I’m just not sure how should I use it? From what I got it downloads a template from whatever repository you input, however, I’m not sure I follow, like will it download JME 3.2 and create a project for me?

yes :stuck_out_tongue:
It’s a tamplate project all configured, using gradle, and gradle will download the jme dependencies for you.
Though I highly recommend you take a look at gradle’s basics to understand what’s going on
https://docs.gradle.org/current/userguide/overview.html

In this sample build file, these are the minimum dependencies necessary for a “blue box” style JME app:

Edit: but note that gradle will pull in transitive dependencies for you. If you are using an IDE or something then you will still have to pull in those dependencies manually (like lwjgl natives, etc.) Easier to just use gradle or maven.

Or actually just use the SDK if one is already using Netbeans, doesn’t actually need Gradle and want the Libraries inside of Netbeans.

There is no real reason to not use it then :smiley:

Coincidentally, I just came into this problem myself. I’m not sure how you’re executing the jar file, but it should be executed using the gradle run task, not some kind of “application” workaround that some people use. I’d be lying if I told you I knew why, but I do know that it works. Maybe someone else with more of an understanding can explain…

Is using Gradle the only way? That seems weird, because from what I understood it’s like a makefile, and it means that everytime I need something more I have to manually edit it so it includes whatever I need.

And judging by what you guys said, this should work on NetBeans, and this is what I have included in the libraries for the projects:

No, but it’s the easiest way for users who don’t know exactly what to do, I think.

Edit one line versus right click and add a jar… and figure out what other jars that jar depends on and add them too, etc… In reality, I almost never edit my build.gradle files once the project is under way. I understand that a GUI is easier but only if it actually IS easier.

Your list misses these for example:
lwjgl-platform-natives-linux.jar
lwjgl-platform-natives-osx.jar
lwjgl-platform-natives-windows.jar
lwjgl.jar

…and includes a whole bunch of stuff you likely don’t even need. (like niftyguid) or at the very least won’t work without a bunch of other jars, too.

The SDK has built in libraries that bundle things you need together. It saves you from some of this, too. Else if you are not using the SDK then you are better off using an actual build tool rather than hand-cobbling a bunch of jars together manually.

1 Like