Distribution

posted by tcm1998

The last week I’ve been thinking a lot about distribution of ACCAT. Writing a good program is one thing, delivering in a handy package is entirely another. Especially in Java, I didn’t know much about the (im)possibilities. So, last week I’ve had a thorough look at the ways I can create a proper ACCAT package.

It all started when I wanted to update the SWT library ACCAT depends on. Everything you see (windows, buttons, sliders, lists, etc) is all part of SWT. Now recently, they’ve fixed a bug that has to do with keystate modifiers during the selection event. Meaning … well, I’d like to use shift+click on the catagory buttons to “extend” the selection, rather than have a separate check box for that (as it is now). Thanks to that bug fix, I finally can.

So, I downloaded the newest swt.jar and went looking for the runtime library dll’s that go with it. After a lot of searching I finally discovered that the needed dll’s where actually IN the jar. So, basically, that reduces the needed files from 3 to 2; accat.jar and swt.jar.

Seeing that I no longer needed those dll’s to be in the accat directory, I realised that I might be able to actually make it ONE jar with a program called one-jar. I’ve tried the program ages ago and immidiately saw it’s potential. However, since I needed to spend loads of time developing ACCAT, I put the program in the fridge. It was pretty tedious work to make one jar of ACCAT. However, when I re-downloaded the program (I’d like to use the newest version if possible), it turned out to be the start of a big distribution improvement. One-jar comes now with an ant building script.

Ant

I’ve heard of ant before, but never realised what I could do with it. Ant is basically a cross-platform makefile utility. An ant script can contain all the steps neccessary to build ACCAT in various distribution in a single click (from my eclipse development environment). So .. what’s the ultimate goal here?

I’d like to create several ACCAT packages that are easier for the users. Distribution as a jar file is an option (which I have used since the start), but it leaves a few issues that can easily lead to questions. In fact, they HAVE lead to a lot of questions when I first publicly released ACCAT for ACCF (Animal Crossing: Let’s Go to the City/City Folk. Some people had to cope with problems like; no java installed, jar not associated with java.exe or javaw.exe,ect,ect. So, I’d like to have ACCAT in 3 forms to start with:

- a windows executable
- a ready made archive for Mac OSX
- a pre-scripted binary for linux

And ant is JUST the way to do it. Ok, so what does the future look like?

A windows executable

To create an executalbe for windows, I stumbled upon a program called launch4j. It’s a GUI based program that lets me specify things like what JRE (Java Runtime Environment) does accat need, what kind of “program” do I pack it in, and even which icon should be showing. Furthermore there are loads of parameters to tweak that I haven’t begin to explore yet. All in all, using one-jar combined with launch4j creates a single executable that runs without the help of any other files. If the user doesn’t have java installed, it gives a clear message and gives the oppurtunity to download the java JRE from the sun-website. And as a bonus, it comes with an ant-task so it can be part of the creation script.

A ready made archive for Mac OSX

Ultimately, a dmg-file would by ideal for the Mac. Unfortunately, therre’s no way of creating such a file from a windows environment. So, I’ll have to go for the next best thing. In fact, ACCAT has already been in such a package for some time. I’ve been told that it works fine. However, creating a new version of ACCAT, means I have to “inject” the new jar into the old package and make sure the executable attribute of the script within the archive is set. Unfortunately, that’s only possible in a unix-like environment, which I used to use msys for. However, since I recently discovered that it also is possible with ant, I can now build a mac package from scratch as part of the distribution building process.

A pre-scripted binary for Linux

For Linux, there’s really no ready made way to do it.  However, on the launch4j forum I read a tip that I’d like to start using.  It basically involves concatination of a little shell-script and the accat.jar so that when a user starts it, ACCAT is either started or a clear message WHY it doesn’t start is given.  This is a part that I just read about and haven’t tried it out yet. But I’m pretty confident it’s a good solid sollution for Linux.   And .. you,ve guessed it, creating it is possible using ant.

Conclusion

So, concluding I can say “the discovery of ant opened my eyes”.  Once I figure out how to write ant-scripts, ACCAT will be distributed in the way described above, which is much more user friendly.   I’m happy that I have put some time in this part of the project.

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s