Distributing games

I installed lwjgl and got it working with netbeans after putting all the files in the ext/ dir under java sdk. Problem is that when I try to run the application from the command prompt, I get noclassdeffounderror org/lwjgl/opengl etc… How can I fix this?

And one other thing. If I would like to distribute anything, like a game or anything, using lwjgl, how would I package it and what would the client have to install to get it all to work?

[quote]I get noclassdeffounderror org/lwjgl/opengl
[/quote]
lwjgl.jar needs to be in your classpath somehow…

I usually just have a lwjgl.jar and it’s companion dll’s (lwjgl.dll & OpenAL32.dll)in the base dir too. I then run the application using java -cp lwjgl.jar;;

To run directly from Netbeans, I would suspect that you need to mount the lwjgl.jar in order to get it onto your classpath.

[quote]how would I package it and what would the client have to install to get it all to work?
[/quote]
Assuming your game is in MyGame.jar, and that the jar is placed in the root directory just place lwjgl.jar, lwjgl.dll & OpenAL32.dll alongside.

Then start the game using java -cp MyGame.jar;lwjgl.jar; .

Using java -jar MyGame.jar needs some way of telling that it depends on lwjgl.jar - haven’t done anything of this kind though…

I simply ship the whole game in one jar. (Well, actually I compile it into an .exe but that’s another story).

Cas :slight_smile:

Hehe you JET snob :wink:
Well do you extract all the files from the lwjgl and put them in one jar with all the other files that belong to the game?

As far as class libraries usually the best thing to do is to make your on jar manifest file (META-INF/MANIFEST.MF) where in you can specify classpaths to other jar files. The manifest also lets you control things like the base class to use and signed classes if your into that kind of thing.

Once its all done. Pack all the libraries and your own code into the single jar. Then like automagic you type ‘java -jar myjar.jar’ and everything just falls into place.

Look at
http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html

Now a more complex question and one that has been bothering me is the question of the JRE itself. Currently you either need to ship out your package and hope they have a JRE installed or make several distributables for each OS you want to “support”, which include your package plus the JRE. I’ve been thinking about how to sidestep this without going the InstallAnywhere route.

I’ve got to say my solution is rather more brute force - bung everything in one fat jar file - but it’s easy :slight_smile:

That’s what I build my Jet executable from, then I run it through JetPerfect (the bit that cost me 500 of the Queen’s pounds) and bingo, one nice small .exe that runs like a greased weasel without any installation woes.

Cas :slight_smile:

Yeah, I can wish for getting JET as my birthday present, … not :slight_smile:

Hey princec out of curiosity, what was the performace difference between jet optimized, and standard java for you?

Jet’s approximately the same speed as -server, but with instantaneous startup time and 100% full speed from the off. For Alien Flux anyway. And the terrain demo.

GC in Jet may be better - I never see a single dropped frame after all the resources have been loaded - not a single one. Memory consumption is better.

Cas :slight_smile:

As a side note, don’t you think it’s probably time for Sun to start supporting native compilation? I mean for these kind of apps, it seems to me it makes no sense to completely dismiss it.

I hope they never spend their time on native compilation instead of improving the language and VM. Princec’s results just show what I had beleived before. Native compilation doesn’t help execution speed, and ties the result to a single platform. For me I can live with the slightly longer startup. Making multiple targets is more of a bother for me than the drawbacks that a standard JAR might have.

If you want to do native compilation because the benefits are important to you (faster startup and consistant operation from the get go can be significant) - you can! Use JET. Sun doesn’t have the resources to do everything, so let the JET guys have that.
There is enough to improve with what Sun already has.

At the risk of effectively posting “Me too!”, I have to say I agree with you! ;D

No one company should handle every interaction with a system such as Java - that would tend things towards a monopolistic control and end up with another Microsoft. Sun can concentrate on making Java a great language and platform, and other people can handle native compilation.

Hey, it provides revenue for people like Excelsior!

I agree too :slight_smile:

By the way, any idea when a new LWJGL will be released? I have had some people having problems and weird crashes when trying to run my game using it… great work by the way! I hope you will have the motivation to continue working on it for many many years to come :wink:

Let’s assume we’ll get 0.6 out of the door when Alien Flux works, which right now seems to either crash unexpectedly or work perfectly depending on whether there’s an R in the month and a number I just thought of matches another number…

Cas :slight_smile:

Oh ok so I suppose Alien Flux doesn´t use the 0.5 lwjgl but your devel version?

'srite. You can compile it from the CVS. Or of course you can just lift the code straight out of AlienFlux (open the jar, delete all the files that aren’t in org/…) and use the DLLs I’ve compiled for you.

Sneaky way of getting an “early access” release eh?

Cas :slight_smile:

[quote]I hope they never spend their time on native compilation instead of improving the language and VM.
[/quote]
Yeah, well I agree with you here.
I was not clear: I was just questioning the position Sun is taking that it seems to simply dismiss the idea completely where it does have its uses here and there. They don’t actually have to make native compilers.

On another note… is there any news on the Mac OS X version of LWJGL?

I’m a recent switcher, since I got work to buy me a Powerbook. I just grabber the source from CVS, but I’m so green on Mac OS X programming, or even any unix programming that I don’t think I can do much with it my self. Although if I can spare some time I wouldn’t mind helping out a little with the port. I can at least help play games, er… test it :slight_smile:

AFAIK, Gregory Pierce who is working on it - is a bit tied up with Real Life. He works for CNN which as you know are a bit more busy than usual.

Hmm would be nice to have LWJGL working on macintosh as well, although I am not planning to even touch one, but could be nice if it worked on that platform as well :wink:

Btw, anyone know when I will get rid of the YABB Newbie “tag” by my name? :wink: