Jarnal - a Java Journal

by David K. Levine
Jarnal is an application for notetaking, sketching, keeping a journal, or annotating a document using a stylus, mouse or keyboard. It is similar to Microsoft Windows Journal and to the earlier Mimeo whiteboarding application. In its original incarnation it was completely pencentric and did not support the keyboard at all, making it suitable only for use with a tablet PC. In its current incarnation it is similar to Microsoft One-Note and can be used to take notes with the keyboard as well as with a pen. You can download the jar file here. To use execute use the commands java -jar jarnal.jar [options] [file_to_open]. Command line options
If filename begins with http:// the file will be downloaded from the url rather than loaded from the local filesystem.

Jarnal screenshot

This is alpha level software: the key features are complete, but I have not yet tested it carefully. It is sufficiently stable that I am now use it on a regular basis to do real work. It should work with Java 2 1.4.2 or later. Jarnal runs both as an application and as an applet. CLICK HERE FOR A DEMO.

If you are interested in this software and run Linux, you should also take a look at Gournal, which currently offers shared whiteboarding capability not available in Jarnal. I will try to make Jarnal file compatible with Gournal so as to provide a cross-platform capability for Gournal.

What is next for this project?

Downloads: Stable Binary (0.07) Latest Binary (0.91).

Copyright: I am placing the source code into the public domain - this means you can do whatever you want with it, just don't blame me. The source is contained in the jar files and can be accessed by renaming the .jar file to a .zip file and unzipping. To compile, put the .java files should be in a directory called jarnal, the images in a subdirectory of that directory called images. From the superdirectory of the jarnal directory issue the command javac jarnal/Jarnal.java. You can then run the program by java jarnal/Jarnal and put it in a jar file using jar jar cvfm jarnal.jar jarnal/jmainclass.txt jarnal,

Application Notes

How do the drawing tools work? The pen puts strokes on the top of the display; the highlighter puts them on the bottom of the display. Using the tools menu you can configure the drawing tool with a great deal of flexibility. You can set the current pen or highlighter to be the default which makes it available from the tool bar. The most useful tools appear on the tool bar; thin, medium, thick and fat pens; quick choice of black, blue or red color; yellow or magenta fat highlighters. The whiteout is a white fat pen. The razor and select tools enable you to move things around; the ruler draws straight lines; the eraser erases individual strokes. User configurable options are kept in the .jaj file, and are restored when the file is opened. Text mode enables you to create new text regions and change their width by clicking (and dragging). You may select various text features; if you choose set default text from the format menu, this chosen text characteristics will be applied to any new text regions you create.

What is the file format? Individual pages are stored as standard .svg files. The paper is stored by name in the title of the file, but the actual lines are not stored. A series of newlines demarcates the break between highlighter and pen. Jarnal can read its own .svg files and produces .svg files that should be readable by other applications. It probably cannot read .svg files produced by other applications. Following the idea in OpenOffice, the .jaj file used by Jarnal is a standard zip file containing the pages plus the plain text configuration file, plus the background, if that is being stored in the file. The configuration file is identified by name, but the names of the pages do not matter, only their order. You can also access the svg text by copying individual pages to the clipboard.

Network Save: Saves file to a webserver. Note that the functionality provided is equivalent to submitting a form - the backend capability of processing the form data must be provided separately.
1. Choose Network Save Options from the File menu.
2. Set the server to the page that will receive the file upload in the first box. For example http://www.dklevine.com/workshops/testup.php3
3. Set the variables that will be transmitted in the second box. Each variable is entered on a separate line in the form variable_name=variable_value. For example

account=george
password=monkey

infile=$$jarnal

Which will result in the jarnal file you are editing being uploaded under the name infile, and additional variables named account and password being uploaded with values set equal to george and monkey.

4. In place of a fixed variable_value such as george, you can use special values beginning with $ to represent internal values from Jarnal. Supported variables are

$$jarnal the contents of the jarnal file
$$snapshot a jpg file with a snapshot of the current page of the jarnal file
$f the name of the jarnal file
$p fully qualified pathname of the jarnal file
$n number of pages in the jarnal file
$u a unique identifer, guaranteed not to change as long as the file remains open and is not saved under another name; can be used so that the server can identify the same file being repeatedly saved

5. To perform the upload choose Network Save from the File menu; when running as an applet you can also use the save button.

Background Files: Background image files can be loaded. A background image file can be a zip file consisting of image files, or an image file containing one or more images. The first image will be assigned to the first page of the Jarnal file; the second image to the second page of the Jarnal file. If there is one image in the background file any Jarnal pages beyond the limit of provided image files will be assigned the last image in the file; for multi-image background files images for pages after the last background image are turned off. So if you zip a single image file, that will serve as background for all Jarnal pages. If you zip lots of pages, then you can use Jarnal to annotate the pages. Or you if you have faxes in the form of multi-page tiff files, you can load those in the background to annotate them. You can toggle background images on and off on a per page basis from the paper menu. Image files may be any type of image supported by java: by default this includes jpg, png and gif. You may install additional support for bmp, png, pnm and tif. You may either use an external background file, with the path to the background file stored in the jarnal file, so that when the file is reopened so will the background images (if they haven't been moved), or you may store the background file directly in the .jaj file. If your system has good command line utilities, you can automatically open, for example, a pdf file. Here is a command line utility for bash and linux that uses ImageMagick's convert utility and the zip utility to convert an input file $1 into a background file $1.jbg and open a new jarnal file with #1.jbg as background.

#! /bin/bash
convert $1 ${1}%03d.jpg
zip -m ${1}.jbg ${1}???.jpg
java -jar /directory_with_jarnal.jar/jarnal.jar -b ${1}.jbg

MetadataFiles: A metadata file is a text file containing command line options plus other options. Here is a sample

[Globals]
jarnalFile=http://localhost/main/docs/newfiles/hi.jaj

templateFile=http://localhost/main/docs/newfiles/hi.jaj
netServer=http://localhost/workshops/testup.php3
backgroundFile=whatever

[Net Options]
infile=$$jarnal

The format is the usual .ini file format. If you load a jarnal file, the conf information from that file will override the metada information. There are two sections in the metadata file [Globals] and [Net Options]. The [Net Options] section will be used as the default Network Save Options, to send information back to a server. The [Globals] section supports four keys, a jarnalFile to open, a templateFile to open, a backgroundFile to open, and a netServer to send network saves too. The intended usage is that a web server can generate a metadata file on the fly instructing jarnal what file to download and open, and where the server is so that the file can be saved back to the server.

Applet Parameters: The applet uses parameters to set the metadata. It understands the parameters netServer and the parameters pn where n is an integer, and the parameters are numbered sequentially starting with 0. The numbered parameters become [Net Options]. For example the jarnal-demo.htm file uses the following

<applet code="jarnal/Jarnal" archive="jarnal.jar" width="20" height="20">
<param  name=netServer  value="http://www.dklevine.com/workshops/jarnal.php3">
<param  name=p0  value="just=a test">
<param  name=p1  value="infile=$$snapshot">
</applet>

This will cause the network save function to send a jpg snapshot under the name infile to the php script
http://www.dklevine.com/workshops/jarnal.php3. Note that due to java security restrictions, this script will work only if loaded from www.dklevine.com.

Priorities: When opened as an application, parameters can be read from several locations. If both a template and a file to open are specified, whichever appears last on the command line is used; if a template was specified, the whichever file is used is treated as a template. If a metadatafile is specified, the background, template and file replace those specified on the command line. The template in a metadatafile always has priority over opening a file. The background in the file or template that is opened take priority over those specified in the metadatafile or the command line. The parameters in the file or template that is opened take priority over those in the metadatafile, except that if the netServer or [Net Options] are not set in the file or template, the values specified in the metadatafile continue to be used.
Transparency: Highlighters can have three levels of transparency: opaque (the old default), translucent or transparent. This is set on a per page basis; if you are annotating background image files, you will probably want to make your highlighters transparent so you can see the background through them.

Why is this program better than Microsoft Windows Journal or One-Note? Because it is written in Java files can be edited and viewed on any platform, and the editor/viewer is freely redistributable - not to speak of customizable. MS Journal files can be edited only on a Tablet PC and viewed only with Windows XP or 2000. One-Note also uses proprietary file formats that can be viewed only on a few platforms, and edited only by purchasing the latest version of Microsoft Office. In Jarnal the files are in a standard non-proprietary format, human readable, and usable by other applications. By default, no information identifying the author is stored in the file. Jarnal also offers document annotation capabilities and networking connectivity not available with the MS programs.

Known Limitations:

Release Notes

current 0.36 - fixes a variety of bugs with  restoring saved text, including one that would cause the program to crash if it was first opened on a document containing text

current 0.37, stable 0.05 - stable version fixes the restoring saved text bug; an additional small text display bug is fixed and the version information is now displayed in the about box.

current 0.38 - added a date/time stamp

current 0.41 - fixed another bug with saving text and a bug with the placement of text when the screen is zoomed

current 0.43 - further work to make sure the save text bug cannot recur; fixed the display of the razor tool; when there are no changes to be saved the save button is now greyed out rather than a message in the status bar

stable 0.06 - same as current 0.43

current 0.44 - fixes some bugs with directory handling and determining when the document needs to be saved; added the "Save On Exit" option: this means that if the document is an existing document that has been modified it will be saved upon exiting the document without any prompt. Modified the file opening procedure so that if you open a file in an empty document it opens in that window rather than creating a new one.

current 0.45 - improved file handling, including killing more bugs; cloning the existing configuration when opening new files and allowing reversion to the default configuration. Added "bookmarks" akin to most recently used files. There is no limit on how many bookmarks can be remembered, and they can be deleted. Since bookmarks are stored in the jaj file along with all other configuration information the default for any new file is not to save bookmarks. This is so that if you send your file to someone else, you won't accidentally send them your bookmarks too.

current 0.48 - fixed some bugs with undoing text. Added a global bookmark list, so you don't have to fumble around looking for the window with the bookmarks you want.

current 0.49 - cut/copying an entire page now copies the text on the page to the clipboard, so you can easily copy text into another application such as a word processor.

current 0.50 - fixed some small bugs, including a problem erasing when there is text on the page.

current 0.55 - added the ability to load background files of images, added transparency for the highlighters.

current 0.56 - fixed some printing bugs

current 0.67 - added the "Top Eraser" tool on the tools menu; acts as complement to the razor by deleting everything above the cursor when released.

current 0.69 - added many usability improvements in dealing with backgrounds; image files, including multiple image files can be opened directly, and need not be wrapped in a zip file; the open background dialog now by default shows all files; the paper can now be sized to the background; the "next page" button will now add a page if it is on the last page, and if the background file contains more than one image, pages added after the last available background will have the background turned off.

current 0.70 - added the ability to store background files directly in the .jaj file.

current 0.71 - cosmetic work, some internal cleanup, plus modified the way background files stored in the .jaj file work - now undo should work properly with backgrounds saved in files.

current 0.72 - preliminary support for network save functionality

current 0.74 - further work on network save

current 0.85 - added the ability to download files from url's and the ability to read metadata files

current 0.86 - fixed a bug that prevented network save when the file wasn't save; now network save works with the applet. Improved the applet gui

current 0.87 - added the uploading of a snapshot - useful for handwritten email attachments

current 0.90 - the applet can now read parameters

stable 0.07 - same as current 0.90

current 0.91 - rationalized the priorities for setting files and parameters

current 0.92 - if a template and background are opened together and the template has only a single page, that page is now resized to match the size of the background

current 0.94 - fixed bugs with the handling of net options