This page last changed on Nov 01, 2007 by ganand.

With the release of Confluence 2.6.0, many files have been moved inside the main .jar file, which means they can no longer be edited by simply opening and saving a file.

For those not familiar with the terminology, a .jar file is a Java ARchive file. It's like a Unix .tar file, and is managed by a very similar command-line tool jar which is included with the JDK. Essentially, it takes several files, or an entire directory structure, and compresses them together into a single file. This saves a little space, and makes it much easier to manage that group of files as a single unit. The terms "file" and "archive" can be used interchangeably in this context, as they refer to the same collection of bytes.

To edit a file that exists inside a .jar file, you need to unpack the archive, perform the desired edits, then re-pack the archive. To do this on Unix/Linux, follow these steps:

  • create a new working directory, e.g. /tmp/confluence-working
  • cd into that directory
  • extract the contents of the .jar: tar xf </path/to/file.jar>. To edit the main confluence .jar: tar xf $CONFLUENCE/confluence/WEB-INF/lib/confluence-2.6.0.jar
  • you now have a directory structure, or at least a set of files, which are the contents of the .jar archive
  • edit the files as you normally would
  • ensure the original .jar isn't in the working directory. If you copied or moved it there for unpacking, delete it or move it elsewhere, to prevent it becoming part of the new archive.
  • repack the archive: from within the working directory, issue the command jar cf </location/of/new/archive/file> * to produce a new archive under /tmp. The asterisk is significant, as that tells jar to include all files and directories within the working directory. E.g. jar cf /tmp/confluence-2.6.0.jar *, in our example here.
  • take a backup copy of the original .jar file. It's often convenient to leave it in the main Confluence directory and just rename it to something like confluence-2.6.0.jar.original.
  • copy the new .jar into <confluence-install>/confluence/WEB-INF/lib/
  • restart Confluence

These instructions assume a Unix environment, but they also apply to Windows for the most part. If you're working at the command-line, the only real change will be substituting dir for cd.

Document generated by Confluence on Dec 20, 2007 19:02