Writing java code for multiple platforms

Started by numberR, April 23, 2005, 15:29:35

Previous topic - Next topic

numberR

hello guys.

i recently got mac mini and testing my lwjgl game on it. it runs on Windows and Linux, so i was expecting it torun on Mac OS X as well, but i was wrong. it doesn't.

does anyone have some kind of tips for writing java code for multiple platforms? error i'm getting is OutOfMemory error and thing that i don't understand is it works on Windows and Linux, but Mac OS X. i know implementations of file related java interface really depends on platform, but then what kind of approach i should take for file reading, especially when you need to load large file like map file? FileInputStream/RandomAccessFile etc.

thanks.

lightbringer

One thing you could try (apart from picking a different format for your map data :D ) is passing memory flags to the vm.

for instance:
java -Xms128m -Xmx128m -jar your-game-here.jar

I don't know if this is good or bad, but it works for me. On windows, at least.

numberR

thanks for the reply.

i've tried that before and it still gives me java.lang.OutOfMemoryError. weird thing is that my game runs with -Xmx96m on both of Windows and Linux, but Mac OS X. even if i set -Xmx512m, it still gives me java.lang.OutOfMemoryError.

one thing i noticed before was that, FileChannel.map method works well on Linux but not for Windows for reading large file. i'm guessing there will be some kind of issues like this on Mac OS X as well, and wondered how people are dealing with these issues.

i think tribal trouble works pretty well on Windows/Linux/Mac OS X. how do they achieve such portability across those platforms? what kind of class do they use for reading large file from hard disk?

[edit]
i think it possibly be a company's secret, but i would be happy to know if they don't mind letting us know any of information about it...

princec

There's no tricks to it... but MacOS Java implementation has a few oddities all to itself, and LWJGL falls slightly foul of them in certain situations.

Cas :)

numberR

i found what was causing my problem. it was simply an order of ByteBuffer. sorry for my stupidity...

i appreciate all for replies.