[LWJGL] Jar compiled on windows wont run on mac

Not sure if this really has anything to do with LWJGL-- I’m not quite sure what’s going on here.

My game runs perfectly fine on both windows and mac, if I run from eclipse.

If I compile under my mac, I can run the jar on both my mac and my pc
If I compile under my pc, I can only run the jar on my pc. When I attempt to run it on my mac, I get some JVM crash:
crash report

Any ideas what’s going on?

[EDIT] After reading the crash report with some highlighting, I see that it has to do with creating the display. Here is my display creation code:

public static boolean initDisplay(int width, int height, boolean fullscreen) {
	try{
		PixelFormat pixelFormat = new PixelFormat(24, 0, 0, 0, 0);
		ContextAttribs contextAttributes = new ContextAttribs(3, 2)
			.withForwardCompatible(true)
			.withProfileCore(true)
			.withProfileCompatibility(false)
			.withDebug(false);
		
		if ( GameSettings.fullscreen ) {
			Display.setDisplayMode(getDisplayMode( width, height ));
		} else {
			Display.setDisplayMode(new DisplayMode( width, height) );
		}
		Display.setFullscreen(fullscreen);
		Display.setTitle("Game Engine");
		Display.create(pixelFormat, contextAttributes);
        
        return true;
	}catch(Exception e) {
		e.printStackTrace();
	}
	
	return false;
}

Hi

It’s a crash in the native code, it has nothing to do with the way you compile or package your game.

So what do I do?

It runs fine everywhere when I compile it on mac.

what does AutoreleasePool in /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation do ?

check the bytebuffer arguments to org.lwjgl.opengl.MacOSXDisplay.nCreateWindow(IIIIZZZZLjava/nio/ByteBuffer;Ljava/nio/ByteBuffer;). called by lwjgl.opengl.Display.create() and gl.util.DisplayHelper.initDisplay().

i bet they’re off :wink:

o/

Code for the display.create() and initDisplay() are above. I assume the problem resides in the PixelFormat?

yes probably.

format ant attribs are converted to bytebuffers somewhere deeper before passed to nCreateWindow. i think it’s “just” the regular crashing caused by fault memory. in your case, i get the feeling that it’s related to releasing the memory.

I just don’t get why when I take the same exact source code I’m using on windows, and compile it on my mac, it runs fine :confused:
Then if I take that mac export, and put the jar on my windows machine, it also runs fine. Whereas the opposite causes a JVM crash.

Makes no sense…

that’s true :slight_smile: obiously it’s coming from osx native code. that’s why i’m wondering what AutoreleasePool in /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation does.

but i don’t have a mac, not a big help here :open_mouth:

o/

I wouldn’t have the slightest clue on how to check that for you xP
I hardly know how the mac os works.