Running multiple instances? Solved

Hi. I’m working on implementing networking and for speeding up the development process, I’d like to click a button (with a SDK run configuration probably) that will launch a server instance and a client instance.

I tried creating a new run configuration and responding to that from within the Main class by creating several instance of Main and calling .start on both of them.

But I got an error:

java.lang.IllegalStateException: From thread Thread[LWJGL Renderer Thread,5,main]: Thread[LWJGL Renderer Thread,5,main] already has the context current
at org.lwjgl.opengl.ContextGL.checkAccess(ContextGL.java:184)
...

The annoying thing is, if I want to run the game as two instances, the SDK doesn’t want me to. The run button is grayed out while a process is already running.

How would I best do this?

I suppose I could do a build and then write a bash script that would do this for me.

You should be able to run two or more instances… The run button should only be grayed out if you’re trying to debug the application, in that case yeah, its not possible to debug two instances simultaneously so it won’t let you do that.

I had the same problem running two instances but I could run the 2nd instance once I tried running the project with a different class opened.

Yeah, it seems that the run button is greyed at initially, but whenever you change the opened file, it becomes green again!