How to use Jmonkey in another IDE

Hi guys, so I need to use another IDE to use jme(the SDK is not fully updated and I need some of the newer versions features).

Could someone help me setup a jme project in another ide or code editor(any is fine). I know this is a lot to ask for but to be honest, I have no idea what I’m doing.

I’m not ashamed to admit this, I’m a total rookie and this is probably a very trivial matter but I’m confused because there isn’t an in depth guide on this.

I know you’re supposed to download the libraries and include them but that’s about all I know. I don’t know the specific nuances of setting it up.

Please forgive my ignorance, this is my first experience making a full project with programming, I apologize in advance if I ask some pretty dumb questions.

Anyways thank you guys!

What IDE are you using?

I’m using VSCode but I’d prefer it to be possible with Geany(since my teacher loves geany)

We’ve been working on https://start.jmonkeyengine.org/ which will create a starter template using gradle. Then you can open that in any IDE that understands gradle (I’d suggest intellij) or even an IDE that doesn’t understand gradle and build through the command line.

It’s a work in progress so it would be good to hear about any issues you experience (known issues include that the mac deployment isn’t quite right and that’s something i plan to work on today)

5 Likes

Wow this looks really good. I’ll give it a try and see how it works.

2 Likes

Do you plan to have that a stand alone to run locally on their machine?

Sorry, know very little about it. I use it for PHP designing my companies website, never used it for Java.
I use Eclipse, IntelliJ or JME (Netbeans). I don’t like Netbeans, I don’t like the speed of it. It performs slowly on my machine.

The idea of the initializer is that it produces a zip that people can download. So yes, it ends up with a jmonkey project being run locally

I meant, is the program locally, or you have to go to jmonkeyengine.org every time. A stand alone application like LibGDX does. just a Simple application that creates it.

I meant, is the program locally, or you have to go to jmonkeyengine.org every time. A stand alone application like LibGDX does. just a Simple application that creates it.

O, I see. Well you could download it locally and run it (Its a spring boot application and the source is all publicly available at the jmonkey GitHub repository) but you’d still interact with it from the browser via http://localhost:8080 so I don’t really see why you’d want to. What use case do you have in mind that couldn’t be done from the web version

So can this be used in any ide without preparation? I just need to open the folder in my ide? Or do I need to do any additional setup.

It’s similar to lwjgl customize tool at their website LWJGL - Lightweight Java Game Library.

Ok so I setup this up in VSCode and when I ran the file, I got “ExceptionInInitializerError”

this is the full error

INFO: Running on jMonkeyEngine 3.5.2-stable
 * Branch: HEAD
 * Git Hash: 8ab3d24
 * Build Date: 2022-04-21
May 20, 2022 12:23:50 PM com.jme3.app.LegacyApplication handleError
SEVERE: Uncaught exception thrown in Thread[jME3 Main,5,main]
java.lang.ExceptionInInitializerError
        at org.lwjgl.glfw.GLFW.glfwInit(GLFW.java:1046)
        at com.jme3.system.lwjgl.LwjglWindow.createContext(LwjglWindow.java:203)
        at com.jme3.system.lwjgl.LwjglWindow.initInThread(LwjglWindow.java:529)
        at com.jme3.system.lwjgl.LwjglWindow.run(LwjglWindow.java:662)
        at com.jme3.system.lwjgl.LwjglWindow.create(LwjglWindow.java:493)
        at com.jme3.app.LegacyApplication.start(LegacyApplication.java:490)
        at com.jme3.app.LegacyApplication.start(LegacyApplication.java:442)
        at com.jme3.app.SimpleApplication.start(SimpleApplication.java:126)
        at com.mygame.Game.main(Game.java:18)
Caused by: java.lang.IllegalStateException: GLFW may only be used on the main thread and that thread must be the first thread in the process. Please run the JVM with -XstartOnFirstThread. This check may be disabled with Configuration.GLFW_CHECK_THREAD0.
        at org.lwjgl.glfw.EventLoop.<clinit>(EventLoop.java:30)
        ... 9 more

How do I resolve this error?

Notice, you are using macOS, check this from lwjgl glfw :

image

https://www.lwjgl.org/guide

EDIT :
Add this -XstartOnFirstThread to the run command.

1 Like

How do I add this? Is this in build.gradle?

1 Like

Try :

tasks.withType(JavaCompile) {
    options.compilerArgs += ['-XstartOnFirstThread']
}

in your build.gradle.

EDIT:
Please report if it works, so we can take action and add that line to mac deployment project.

1 Like

Doesn’t seem to work. I still get the same error. Do I need to place this block of code somewhere specifically? Right now I just have it at the end of the build.gradle

Alright i suspected that too, since compile args isn’t the same as vm args, and gradle docs isn’t very direct you may try this :

org.gradle.jvmargs += ['-XstartOnFirstThread']

copy/paste it at the build.gradle.

Where would this be in the build.gradle? By itself or in the task.WithType?

By itself, not inside any task and at the bottom (better).