Sunday, November 6, 2011

Morgan's Raid on CD

We recently received a request to make Morgan's Raid available to a school that has blocked Internet connections from its lab machines. Morgan's Raid was built for distribution via Java Web Start (JWS), which simplifies the process of dealing with native libraries. However, as the name implies, the technology was designed for computers with Web connections. Distributing as an executable jar is not possible because they do not adequately handle native libraries.

The JNLP file contains all of the configuration information for JWS. This includes codebase, through which JWS determines where to find referenced resources. The Morgan's Raid codebase points to the server that hosts the jar files, for example. Turns out that if you leave out the codebase, it will default to the same path as the JNLP file itself.

My next step, then, was to revise the Morgan's Raid JNLP file for local files. I created a CD containing all the requisite jar files and the revised JNLP file. Running the JNLP file off of the CD almost solves the problem. The game runs, and it creates a desktop and start menu shortcut in the process. However, it also records the fact that the jar files came from the optical drive. As a result, the game will then only run with the CD in the drive, even though all the jars have been copied to Java's cache: JWS still tries to check the codebase to see if there's any changes to the files or configuration.

The problem is easily solved by having the user copy the CD contents to any folder on their hard drives and running the JNLP from there. Now it's this path that is recorded by JWS, so using the desktop shortcut or start menu shortcut will happily run the application locally. This gets the desired result that I can hand someone a CD, and they can put it on as many machines as desired, without my having to fiddle with installation software beyond JWS. (I guess that changing the location of those files would break the installation, in the same way that removing the CD did before, but I did not verify this.)

With my CD experiments successfully concluded, and after a little help from my department's friendly system administrators, the result looks like this:

I found it deeply satisfying to hold this disc. Physical media doesn't change the existential state of the software system, but there's something about holding this disc in my hands that made the software more real.

As I was printing the CD, a sysadmin asked, "Does it have to be on CD?" Her reason for asking was that she had blank white DVDs, on which the printed label would be more crisp, but I thought she meant, "Can't it be on something other than a disc, like a thumb drive?" I laughed aloud when I realized that I had never considered anything but an optical disc for this project, because, you know, software comes on discs!

No comments:

Post a Comment