Jarx for developers

You can add Jarx to your own Java programs and provide a better experience to the user.

Disadvantages of distributing just the JAR file

You might think distributing only a JAR file to Windows users is enough. Unfortunately, a JAR file has some serious drawbacks:

  1. Java might not be installed. The JAR file just won't work and users will think your program is broken. You can mention in the manual that the user has to download Java, but many users don't read the manual and don't know how to install Java.
  2. Even when Java is installed, the .jar file extension association can be "stolen", e.g. when installing an unzip program.
  3. Currently, JAR files have a standard Windows document icon, which doesn't look like an executable. So even when Java is set up right, the user looking for an executable might skip the JAR file.

Jarx overcomes all these problems.

When you distribute a Java 1.1 program, Jarx has even more advantages:

  1. Java 1.1 JVM's don't read the manifest file. Jarx does, even with a Java 1.1 JVM installed.
  2. Jarx will first try to load a Sun JVM and when that fails, it loads the Microsoft VM. Microsoft's VM still has a large installed base, so Jarx does not force users to download the JRE when it is not really necessary.

There are three ways to use Jarx together with your Java software

  1. Associate .jar with jarx.

    By associating the .jar file extension with the jarx program, every JAR file will become "executable". The JAR file can be double clicked, selected from the Start menu etcetera. To have a executable JAR file, it must contain a manifest file. You can find more information about the manifest file in the JAR File Specification.

  2. Associate .jarx with jarx.

    A file with the .jarx file extension is a configuration file, just like the manifest file. See below for the format. In this file you can describe which JAR file to load and which class contains the main method to execute. You can start your Java software by double clicking a jarx configuration file.

  3. Associate your own extension with jarx.

    If your Java program is document-oriented, you can associate your own file extension with jarx. Jarx will then execute your JAR file with the document as a parameter. A document can be anything, including, for example, an image. You can do this by making a default.jarx file in the same directory as the Jarx executable. See below for more information about the .jarx file format.

The .jarx file format

The Jarx configuration file, with the .jarx extension, gives the Jarx program information about which JAR file to load and which class to execute.

The Jarx configuration file is a text file. Every line starts with a name, followed by a colon ':', folowed by one or more spaces, followed by the value.

NameValue
jar-file(Relative) location of the JAR file.Obligatory
main-classThe full class name of the class containing the static void main method, just like in a manifest.mf fileObligatory
class-pathThe classpath. When left out, the JAR file will be the only entry in the classpath.Optional
version-minMinimum supported Java version. When the installed version is older, the user will be asked to download the newest version. The value must have the format <number>.<number>.Optional

An example Jarx configuration file is:

jar-file: GameOfLife.jar
main-class: org.bitstorm.gameoflife.StandaloneGameOfLife
version-min: 1.1

You can download the Game of Life to see how Jarx works with other software. On the Game of Life source code page, you can find an installer script for the free NSIS installer program.

Download

You can download the plain jarx.exe or download and install the end user installer from the Jarx web page:

License

You are allowed to distribute the Jarx program (jarx.exe) with your freeware.

In this context, freeware is defined as conforming to these three conditions:

  1. The software can be freely downloaded from a public Internet address.
  2. The software can be freely downloaded without restrictions (like registration).
  3. The software can be freely redistributed (on CD-ROM's, other websites etcetera).

For further questions, please contact Edwin Martin <edwin@bitstorm.org>.