Compiling Source Code To Java Web Start Programs

THL Toolbox > Developers' Zone > Compiling Source Code To Java Web Start Programs

Compiling Source Code To Java Web Start Programs

Contributor(s): THL Staff


Our software is in general built and maintained using Source Forge is an array of servers and tools devoted to storing the underlying source code for software in such a way that multiple programmers can work on the code, and periodically submit their fixes, updates and enhancements. All software stored on Source Forge is "open source", which means not only can it be freely used by anyone, but the actual source code is made available to people so that it can be altered for new usages by anyone. The great power of the open source movement is that it discourages the syndrome of reinventing the wheel, and encourages collaborative development of computing resources.

However, this source code as it is revised must still be complied into a functional program that an end user can install and use. For our Java software, we use the following process to make these revisions available to the end-user immediately. To begin with, the SourceForge servers only have the source code (here is external link: an example )

This source code must then be "compiled" to form a usable program, which is termed a "build". We use a tool called Ant to invoke the Java compiler. End users only install "Java", which does not include a Java compiler - only developers use the Java compiler. A nightly build then is when a program checks every night for new source code, and if available, compiles a new "build" so that end users can take advantage of the changes in their use of the program. SourceForge doesn't offer the resources to use their computers for nightly builds, so an external server has to be relied upon to do this. The Process

The external server (such as UVa's, does the following steps each night:

  • Download the latest source code from using CVS.
  • Run Ant to invoke the Java compiler (and a few other things (javadoc and JUnit in Jskad's case) and then zip everything up into the form that Java Web Start likes.
  • Copy the compiled stuff into the right place so that the link from the main Jskad/QuillDriver page works. (If you run the Java compiler on viva.lib, you'd then have to copy the results to orion.lib. If you compile on orion, as we do, this step is nearly trivial.)
  • E-mail a summary of the results (or full output from all the tools) to someone in charge of the program; This is because things do go wrong occasionally and require manual intervention. Most often, some developer commits a change that means things don't compile on orion, or that a test case fails. Another commit usually fixes things. Sometimes, though, the developer has to log on to the external server and modify the script that does the nightly builds.

Java Web Start is a technology that allows users with Java installed on their computers to install the software over the Web. Once installed, whenever the program is launched on a computer connected to the Internet, it will check the server to see if there is a new version of the software, and if there is one, automatically install the update. When it works perfectly, it's a very convenient process.

Other Web pages can invoke the software installation or launch directly from their web pages through a simple HTML reference tag (a href) pointing to the ".jnlp" file on server where the JWS files for the software are located.

To actually set up a separate nightly build on an external server takes about four to eight hours of initial set up for someone who knows how to do it. If this is a secondary nightly build - so that one doesn't have to worry about the server stability on the primary nightly build which might be kept on the developer's server), maintenance then can be quite low (say, 2 hours per calendar year) because the secondary server can actually grab the developer's changes so long as his/her nightly build script is CVS-controlled on SourceForge.

Compiling everything, and building the API documentation for developers (see external link: an example), and running the tests that let the developers know that nothing is broken (see external link: an example), can take 15-90 minutes on a server like orion. There's a lot of tedious stuff to do on an external server for a first set of nightly builds, but a second set is less work because you already have a Java compiler and Ant installed on the server, the server is aware of Java Web Start, and so forth.

This page is provided courtesy of the external link: Tibetan and Himalayan Library.