Slick2d Error with multiple instances

Hello guys,

I start my appgamecontainer from a gui, after i close the game and i wanna start another appgamecontainer from my gui i get this error:

java.lang.UnsatisfiedLinkError: org.lwjgl.openal.AL10.nalSourcef(IIF)V
	at org.lwjgl.openal.AL10.nalSourcef(Native Method)
	at org.lwjgl.openal.AL10.alSourcef(AL10.java:810)

You guys experienced this error before?

Its hard to tell what the problem is, make sure your project is set up right. Has this ever happened to you before? Have you used LibGDX and got it to compile before? Have you missed with your PATH/libs since?

I am pretty sure my project is setup right. With only 1 instance everything works fine.

java is unsatified with linking.

openAL binaries are not where “java.library.path” points to.

“java.library.path” maybe not defined.

my guess is, you “start” a new java process from some “gui”, without setting jvm-args.

Thx for your answer.

Here is the code how i start my game from the “gui”

  System.setProperty("java.library.path", "libs");
					       System.setProperty("org.lwjgl.librarypath", new File("libs/natives").getAbsolutePath());

				
						try {
							app = new AppGameContainer(new GameClient("2dRacer",tcpPort,udpPort));
							app.setDisplayMode(800, 600, false);
							app.setAlwaysRender(true);
							app.setVSync(true);
							app.setTargetFrameRate(60);
							app.setShowFPS(false);
							app.setSmoothDeltas(true);
							app.setForceExit(false);
							app.start();

Is there anything wrong?

Like i said,on the first start of this call everything works fine. but the second time i start this on the same vm it gives me the error-message from above.

looks good at first glance.

what if you try-and-error around (pseudo code) :

java.library.path = libs
java.library.path = libs/natives
java.library.path = (libs/natives).toAbsolute

… does that fix it ?

i have problems translating your pseudocode.
i tried this now:

System.setProperty("java.library.path", "libs");
System.setProperty("java.library.path", "libs/natives");
System.setProperty("java.library.path", new File("libs/natives").getAbsolutePath());

is that what you wanted me to test? this didn’t work.

yes :slight_smile: … well, that sucks.

makes little sense to me after second glance. if you do not leave your VM and first time you load it works …

edit

… another guess. even if it doesn not explain the linkageunsatifaction, do you “destroy” the AL device after you close your first instance ?

Not right now, but i tried this before, i called AL.destroy() when i close the game,but it didn’t change anything. :’(

Okay,i fixed the openAl error.i used the methods mentioned in this forum thread: http://slick.ninjacave.com/forum/viewtopic.php?t=3920

Now it occurred another problem :D.
In my second instance the graphic is completely broken.i can only see black,white and grey colors and not really any shapes.
Do i have to release graphic contexts manually or so?

so, cleaning up all al-buffers at al-destroy helped ?

i dont think it is the gl-context. we’d see a proper exception. also, i think when you (re)create a display, all gl-states are set back to their defaults. so that’s probably not causing it.

still it must be something left over from the previous instance. maybe you use static variables to store some game/logic state which becomes invalid for the new instance. look over your init code, everything that could spill over should be cleaned up on disposal.

Okay,big thanks to you. it seems to work,just have to destroy all image data etc. :slight_smile:

yw