I give up...how do you play these games?!

Well, I’ve downloaded a few games so far, but I can’t figure out how to play the dang things. This whole CLASS file business really ticks me off sometimes. Is there some reason that the files don’t compile to regular executables? Anyway, when I download the games, I get JAVA and CLASS files. I tried loading all the JAVA files into Borland JBuilder and compiling but I’d get all kinds of errors. Then I tried running “java (+ class_name)” but it still wouldn’t work. Any help would be appreciated.

Class files so that its cross-platform
Class files don’t require compiling.

Do you have the JRE? Most of the games here are jars as far as I know…

Quickstart guide: :wink:

When you run a Java application on the command line, remember not to include “.class” - if the executable file is “Main.class”, just type “java Main”. (The error would be something like “Cannot find Main.class.class”)

Class files basically each contain the definition of a type of object, be it an Integer, a Button or a Texture. To start an application running, there will be one class that will also contain the main method. Wheras in C/C++ the whole lot gets lumped together as one, in Java you need to specifically target the class file that contains the main method. (The error would be something like “Exception in thread ‘main’ NoSuchMethodError: main”)

You can, however, bundle classes together into an archive - a Jar file. If you’re trying to run a Jar you would normally type “java -jar Game.jar” - a manifest inside the archive will tell Java where the main method is.

If the manifest has not been created, you’ll need to execute something like “java -cp Game.jar Main”, where “Main” is the class containing the main method.

Does any of that help?

Awesome! Thanks a lot!

Oh and on Windows, if you set the .jar extension to be run by javaw.exe, you can just double click it.

For example:
Executable:“C:\j2sdk\bin\javaw.exe” -jar %f

At least I think it was “%f”… or was it “%s” hmmm…

But the j2sdk (without the NetBeans package) or j2re from Sun should automatically set this up for you.

EDIT: Guess what, I was wrong, its actually “C:\j2sdk\bin\javaw.exe” -jar “%1” %*