Java+ is a free (open source) Java preprocessor that
supports multi-line strings with executable inclusions in
Java as in Perl, Ruby, and Python. It is available for
- Simple, general, recursive, digraph-driven syntax, with user-selectable
- No need for JSP, ASP, and Java compilers on
deployment servers (a security concern).
- With the support of Java Web Application
Architecture (JWAA), web applications become networks of
first-class page objects that reference each other as
objects (not via hard-coded url strings). Invalid hotlinks
are detected at compile time.
- Fast. No overhead in either space or time at run-time, and
negligible impact on build times. Skips inputs whose outputs are
up to date so no unnecessary recompilations.
- Automated localization for international applications. Segregates
Java+ strings into ResourceBundle (properties) files. Invarient keys
based on the hash code of the string's value. This is done optionally,
automatically and transparently; no programmer intervention is required.
- Make, Ant and GUI interfaces. Portable to any platform.
- Free software, BSD open source license.
The box on the left is the source directory (srcDir), typically with nested
subdirectories in accordance with the usual java package conventions. The srcDir
contains Java+ source files (with the digraph-based string synax described in
the Syntax section). The srcDir can contain non-Java+ files that should not
be preprocessed or compiled, just copied to the jar so the classloader can find
them (properties files, image files, etc). The srcDir can also contain files
that should be skipped altogether (CVS directories, backup copies, etc).
Java+ handles this according to settings you pass it via the Ant, Make, and GUI
interfaces. Each interface is described in a separate section of this document
(see the links in the top margin).
- See Syntax for the string syntax for the Java+
files in srcDir.
- See Make, Ant and
GUI for how to run Java+ within each build
- java+.tgz (73 kb) md5: fixme
- The java+ distribution as a zipped tar file. This contains
an executable jar (build/java+.jar) with the make, ant and gui interfaces.
All three are Java code that will work on any platform that has Java installed
(tested with Java 1.2 and 1.4 on MacOSX and Linux). All distributions
contain documentation and source code.
- java+.dmg (73 kb) md5: fixme
- The java+ distribution as a Mac OSX .dmg file. This is an experimental
repackaging of the same contents described above. (You'll have to right-click
and choose "Save link as" or similar to download this. I'm still researching
the proper mime type incatation to use for .dmg files).
Expanding java+.tgz (
tar zxf java+.tgz) will create
a directory named java+. Move it to its permanent location,
which will be called the install directory in what follows.
It has the following subdirectories:
- Contains the binary jar (java+.jar) and documentation (html subdirectory).
- This is a script for launching java+. Either add the java+ install
directory to your search path or move java+.sh to your search path and
INSTALLPATH to identify the install directory.
Ensure that the script is executable (chmod a+x java+ on Unix) and
java+ [-ant|-make|-gui] [options] to run it. If you
only plan to use it, that is it, you're done here. Skip to the
for how to use it.
The rest of this section relates to building Java+, not using it.
Ensure that recent releases of Junit,
JWAA are installed, then
modify the project definition files you plan to use with their install
locations, Junit is needed for the Java+ test programs. Ant is needed
for the Ant interface.
- Java+ program (edu) and documentation (html) source files.
The documentation in build/html is built by the Java programs in
the html directory as described below.
- Make (Makefile), Ant (build.xml), and Java+ GUI (build.java+),
project files for building Java+ from source.
Java+ originated as the MLS preprocessor within the
Java Web Application Architecture (JWAA).
Both originated as spinoffs from the MyBank
Digital Rights Management Project (MyBank).
The server side of this system was originally prototyped in Perl
and ported to JSP in the first commercial release. This system
has many web pages that are extensively crosslinked with hyperlinks.
In Perl and JSP, hyperlinks are hardcoded in the html. This made
refactoring excruciating since renaming or moving any page might
break numerous other pages. Since web pages are the top-level objects
from which this system is composed, we began to look for an approach
that treated web pages as first class objects, not as modified
html text, especially one that could check validity of cross-page
(aka object) references. Java+ and JWAA were the results of that
The Java+ Project has so far focused entirely on Java's string syntax,
but more radical enhancements are imaginable. Others on my personal
wish list are:
- The Gui doesn't handle key shortcuts right on OSX. Recognizes Ctrl-C for
Copy (not Alt-C), for example. Should be a simple fix.
- Define/include capabilities ala cpp. Personally I've never missed
them, although compile-time asserts would be useful.
- JavaPlus is currently a lexical scanner. Converting it into a
full parser would open the way to capabilities such as foreach
loops, parameterized classes (templates), and so forth.
- Meta-classes as in Smalltalk and Objective-C. These would be
especially useful for expressing web pages as objects, where the
meta class specifies meta information about the page (such as its
name, url, title, and position in the page hierarchy) and the class
itself defines the page instances. The Java+ documentation was
created exactly this way, with a hand-coded metaclass structure.
- Smalltalk Blocks (Lisp Closures). This is much tougher, even
impossible to mimic entirely in Java, but so useful in practice it
deserves a place on the wish list.
- Parameterized types!
That's it for the moment. The
author welcomes feedback, which will shape developent priorities.