Installers etc

Can anyone recommend a good way to distribute a game written in java, I am using JoGL and JRE 1.5 (though 1.5 is primarily because of the built in high res timer). I’d like to use java web start, but there are some issues with it (most of the files for the game can change other than the actual class files). I think I can use java web start with a signed certificate despite the use of JoGL and the need to have regular file access. Is there some other method of installing that people here would recommend or am I probably better off to go with java web start.

I’m preparing to put out a product for the general public as opposed to custom built software for a business/server side stuff, and I’ve never actually dealt with installing things on unknown machines (at least not since the common practice was to write your own installer back before java had caught on at all). It could just be I need to spend more time examining java web start and experimenting with it more.

InstallAnywhere was quite nice the last time I tried it out, but I noticed that it handles installations of any program now, not only java programs, so maybe it has become a big fat bloated monster ;D

What’s the problem with that?

Webstart will do everything you need, painlessly.
Failing that use Nullsoft’s NSIS installer.

Cas :slight_smile:

I agree, webstart and NSIS are the way to go.

With Java 1.5 JWS becomes a while lot better too ;D

Will.

For Windows, I love NSIS. NSIS is more like a compiler for a special-purpose scripting language. With HM Edit you can get an editor/IDE for NSIS.

When using webstart, what’s the best way to deal with frequently updated files, is it to pick a location on the hard drive and save the information there, if so is there a standard way of doing this (so the files are stored in whatever heirarchy the OS uses… like windows 95/98 put things in program files or my documents, and windows xp puts things in another folder (something like /documents/all users/username). Is there a really thorough site on making use of webstart, I’ve found a few that deal with mostly handling the resources within the jar, which isn’t something I expect to do much of. The webstart tutorials I’ve found mostly seem to assume you won’t be doing any file manipulation and don’t cover much of setting up trusted applications.

[quote]When using webstart, what’s the best way to deal with frequently updated files, is it to pick a location on the hard drive and save the information there, if so is there a standard way of doing this (so the files are stored in whatever heirarchy the OS uses… like windows 95/98 put things in program files or my documents, and windows xp puts things in another folder (something like /documents/all users/username).
[/quote]

            String userHome = System.getProperty("user.home");

Will give you that info.

FileIO is identical to a regular java app (although god knows where the current directory will be pointing to on start up). And Kev’s tutorial (in the Wiki) covers signing your jars to make a trusted application.

String userHome = System.getProperty(“user.home”); covers what I was worried about, I’ll check the wiki, hopefully it’ll cover what I need to know.

And it’s a good idea to make this directory configurable, in case the user isn’t happy with the default directory.

On windows 98 the directory returned is C:\WINDOWS, I was hoping it’d return the my documents directory. What directories are returned on windows xp and linux machines typically? (I’m assuming that since linux is a dedicated multi-user system it’ll be the actual home directory for the current user and that windows xp would return similar).

On linux, user.home is the home directory root (/home/).

  • elias

On windows this will not return the My Documents directory… it is actually one level up from that in the “Documents and Settings/username” folder, which is the correct place really.
I thought there was a way to get at the typical place for user documents in a platform independent way though… just can’t think of it now… maybe it was a webstart thing.

I’ve been told I’m one of the few people still using windows 98 so it’s not a huge problem, any mac users know where user.home points? I’m not at all familiar with the file structure of macs, I’m not too worried about it but if user.home returns the mac desktop folder then it’d prob tick people off installing my game into a sub folder (I feel at the very least I need to drop a file in that directory to point to where the user chooses to install the game).

On OS X user.home is /Users/username

However you shouldn’t be using an “installer” at all on the Mac. You should make a Mac Application Bundle and the use will simply drag that to where they want it.

Typically you distribute Mac software with a disk image file. Teh users double click it to mount the disk and then they can run the program form that mounted image or drag it to somewhere on their hard drive.

There are articles on java.sun.com or java.net about making Application Bundles for the Mac. It is fairly easy, and all you need is the java launcher stub program that you can get from a Mac, then you can build a zip archive of the app bundle. I don’t think you can make a disk image without a Mac.

How well does webstart work on the mac? I’m assuming that it works pretty much the same as for windows machines (and I’ll just need to include the mac version of the jogl native lib).

It works well, and being pre-installed on OS X makes it easy. The only bad thing is that there is no support for the auto download of the required JRE. But they are easy to get from a standard Mac “Software Update”.

Don’t forget http://www.izforge.com/izpack/. It is a full, free installer, written entirely in Java. It uses XML descriptors and allows OS specific scripts. If you want to see it operate, download and install Sqirrel SQL from SourceForge.