Alvin Alexander | Java, Scala, Unix, Perl, Mac OS X

Here's a link to a tool named JSmooth that lets you create Windows executable files from standard Java JAR files. It looks like this can make the installation process on the Windows platform much more friendly.


Ant web build script FAQ: Can you share an example Ant build script for a web application?

Sure, here's a sample Ant build script for a Java web application. I've included other example Ant scripts for Java Swing/JFC/GUI applications on this website, but this one demonstrates how to use Ant to build a web app instead.

Ant Swing build script FAQ: Can you share an example of an Ant build script for Java Swing applications?

Here is another sample Ant build script for a Java application. Again, I hope it can help you "Learn Java by Example", or in this case, "Learn Ant by Example".

Ant Java build scripts: Can you share an example of an Ant build script for a standalone Java application?

This is a sample Ant build script for a Java application I wrote. It is a GUI/Swing application named "AlwaysOnTop". I include it here because I'm a big believer in learning by example, and maybe this Ant script can help you create an Ant script for your own applications.

Note to self: Don't *ever* take shortcuts when writing code, even prototypes. Every time an application gets to a certain size, you'll regret those shortcuts, because you won't be able to do what you want to do in a timely manner.

There's something good to be said about "the simplest thing that could possibly work", but don't take that to mean "taking really dumb shortcuts is okay".


Java String array FAQ: Can you share an example of how to determine the largest String in a Java String array?

Sure, in this tutorial I'll share the source code for a complete Java class with a method that demonstrates how to find the longest String in a Java string array.

Finding the longest string in a Java string array

Here's the source code that shows how to find the longest string in a Java String array:

Java Date format FAQ: Can you show me how to format a Java Date object in a human-readable format?

It's pretty easy to get a Date in a Java program, but it takes a little more work to print a Date in a human-readable format. This article shows how to print a date in a human-readable format.

Java Date format example

Here's a snippet of Java date formatting code I'm working on right now:

Here's a quick example of how to set a default value for an HSQLDB TIMESTAMP field:

create cached table directories (
  dir_id identity NOT NULL,
  directory varchar(255) NOT NULL,
  time timestamp default 'now'

There are other ways to do this, but the important line that sets the default timestamp in the above SQL is this:

time timestamp default 'now'

This is where I'm creating a timestamp field named "time" that automatically defaults to the current date/time when a record is created.


I've written a lot of use case documents lately for software requirements specifications, and as use cases get more complex, I find the need for "sub use cases" or "alternate scenarios". When referring to these from the main use case (or anywhere else), it's nice to be able to use LaTeX's reference capability.

Here are a couple of quick links to articles to the Joel on Software site:

I've been working on a document for one of my customers named "Use Case Best Practices", but then I decided to search the Internet to see if I could find anything similar to what I was thinking.

The best thing I've found is this Coad Letter on Borland's web site. There is enough meat here that I'm scrapping my plans and just suggesting they read that document instead. Kudos.


The checklist provided below isn't ready for prime time, but I wanted to make sure I put a copy of this information somewhere. Basically, I have started to create a checklist of detailed items I need for user interface screens when creating a detailed design specification. So, what I've started to do is list all possible user interface field types, and what features of each interface element that can vary.

Frankly I'm not sure if this is a good idea or not, but if you're into heavyweight processes, this information is certainly needed by someone at some point.

One of the things I learned (or was reminded of) is that -- properly done -- Use Cases really bring out some state-related issues that you can't get from plain old requirements.

I'm working with a client on fixed price software development (and have been doing so for nearly two years now), and this brings a lot of risk to my side of the table, so I'm very careful that we all understand exactly what's being developed.

Here are two quick links to free programs that I've used to convert Microsoft Word documents (aka, ".doc" files) to plain text:

I just started using catdoc today in combination with glimpse, and I'm pretty happy with it. Note that catdoc also includes an XLS to CSV converter, which is most helpful for my current project.


JBuilder has a nice feature that I've started using lately to track "to do" items. These are the places in my Java projects where I know that I need to fix or change something, but I just don't have the time to do it at the moment. So, what I do is create a "todo" Javadoc tag that I can use as both a reminder and a management tool. Here's how it works:

Don't like your curly braces at the end of the line? Rather have them on the next line? What about your block indentation, your else's, your while's, and your catch's, implements, extends, and throws? How about those import statements, and what about that line wrapping?

Problem - the CSV file

You have a file that contains columns of data, and each column is separated by a comma (a CSV file). The width of each column can vary, but the column data is guaranteed not to contain any columns itself, so it's safe to think of the comma as truly being a column separator. So, how do you read the data?

Solution - the Perl split function

Okay, so what you're saying is that you have CSV file data that looks like this:

I've finally finished creating my first two JBuilder OpenTool projects. They are very simple, but time is scarce, so the development process was drawn out. Here are quick links to the two tools:

Keith Wood has written a book about the JBuilder OpenTools, appropriately named "Inside the JBuilder OpenTools API". Here is a link to his site, and here is an even more direct link to the JBuilder OpenTools code samples he has on his site.

Go to Tools | Preferences, and then when the resulting Preferences dialog shows up, choose Browser in the tree on the left hand side of the dialog, then Look & Feel. In the Look & Feel combo box on the right you can choose from the following options: