LWJGL Standalone Launcher

I recently (3 months ago ::)) created a standalone launcher for one of my LWJGL games, and I wanted to share it with the newer members of the community so that they wouldn’t need to create their own. This launcher automatically downloads LWJGL and (usually) Slick from the official site (as of writing this, the URL points to my own webserver, as Slick’s is down), along with of course the main JAR of the game. It then places them in a specified folder in the application data directory (this works on Windows, Linux, and OS X) under the subdirectory “bin”. When it comes time to launch the game, it automatically passes on command line arguments and launches the game.

The launcher also contains an auto-updater, which retrieves a version file from an online host and compares it to a local copy. This version file contains two keys followed by ": " and the value, named “stage” and “version”. The stage should contain a String such as “Alpha”, “Beta”, or “Release”, while the version should contain a String representing the complete version number (e.g. 2.9.0). If both the version and stage of the two version files do not match, the launcher will ask the user if they would like to update, after which it will retrieve the new JAR and version file.

Another feature, though minor, of the launcher is that it displays the progress of each download in the form of downloaded/total kb, percentage completed, and a visual status bar.

Currently, configurable global variables include all URLs, the subdirectory containing the “jar” folder in the LWJGL ZIP the game’s name (used in the GUI), the folder to be created in the application data directory, and the main JAR’s name.

The source code for the launcher may be found here (note that configurables are not set to generic values, and are instead set up for one of my own games), and if you wish to see an example of the compiled launcher, you may click here.

Upon my first time looking upon your library, I notice the line in Downloader:


os.getChannel().transferFrom(rbc, 0, 1 << 24);

me:

–image removed because it’s useless–
NO.

You can’t just download 16 MB! What if the download is more than 16 MB? You have to get the size of the file, then use the figured out size to download that exact amount! See my similar library to understand what I mean. Also, I made a thread for my similar library in which tons of suggestions for improving the code were suggested. For example, you should close things in the finally block. My thread would probably be a good read, because even though I didn’t analyze over the whole source I feel that most of my mistakes are similar to your’s.

On a slightly related note, I like comparing dates of updates rather than version numbers. Then you can have a stage of development called “indev” or something and update without a version number change, which is more convenient.

On a happier note, the getting of LWJGL and having support for all three OSes is very good. I didn’t make support for Mac in my launchers because I don’t own one to test it on.

Alright, thanks for the feedback. I’ll fix the mistake you pointed out, and perhaps add a global that sets whether the launcher compares version files or dates. I’ll also be sure to check out your thread as soon as I get the chance.