JTags

Table of Contents

Introduction

The jtags program generates a tag (or index) file of java files. It includes references to classes and interfaces, methods and class members. The file allows a text editor (especially the
vim editor (see http://www.vim.org)) to quickly find these objects.

Jtags has been closely modeled after the exuberant ctags program written by Darren Hiebert. and distributed with vim.

jtags supports the following Java objects:

Usually only objects visible in other files are included, but private members, classes and methods can be added with special options.

Changelog

Version 0.4 to 0.6

Version 0.3

Version 0.2

Version 0.1

First version released.

How it works

jtags parses all files given on the command line (and all java files found in directories given on the command line) and searches class names, interface names, constants, methods and members and stores them in a tag file. jtags uses a real java parser build afer the java specification and will ignore all java files that have non legal java code in them (it does for example not accept semicolons after methods as does javac).

The tag file will then be read by your editor. The tag file format is understood by many vi clones (although I've only tested it with vim so far).

As it uses the same format for the tag file as the exuberant ctags program, those programs can actually share the tag file, which can be useful for projects that combine Java and C/C++ source.

Usage

JTags [-acBFnNuv] [-{f|o} name] [-h list] [-i [+-=]types] [-I list] [-L file] [-p path] [--append] [--excmd=n|p|m] [--help] [--sort] [--version] file(s) and/or directorie(s)
-aAppend the tags to an existing tag file (default: remove the file)
-cRead only files that have changed since the last time the tag file has been written.
-BUse backward searching patterns (?...?).
-f <name> Output tags to the specified file (default is "tags")
-FUse forward searching patterns (/.../) (default).
-i <types> Specifies the list of tag types to include in the output file. "Types" is a group of letters designating the types of tags affected. Each letter or group of letters may be preceded by either
a '+' sign (default, if omitted) to add it to those already included,
a '-' sign to exclude it from the list (e.g. to exclude a default tag type),
or an '=' sign to include its corresponding tag type at the exclusion of those not listed. A space separating the option letter from the list is optional. The following tag types are supported (default settings are shown in brackets):
   c : class names [on]
   e : constants [on]
   f : methods [on]
   m : class data members [on]
In addition, the following modifiers are accepted:
   F : include source filenames as tags [off]
   S : include tags that are only visible in one package
   P : include tags that are only visible in one file
-L <file> A list of source file names are read from the specified file. If specified as "-", then standard input is read.
-nEquivalent to --excmd=number.
-NEquivalent to --excmd=pattern.
-oAlternative for -f.
-uEquivalent to --sort=no.
-vturn on verbose mode
--append=[yes|no] Indicates whether tags should be appended to existing tag file (default=no).
--excmd=number|pattern Uses the specified type of EX command to locate tags (default=pattern).
--help Prints this option summary.
--sort=[yes|no] Indicates whether tags should be sorted (default=yes).
--version Prints a version identifier to standard output.

Examples

Tag all java programs in the current directory:
       jtags *.java 
Tag all java programs in the current directory, but ignore files that have not changed since the last time the tag file was written:
       jtags -c *.java 
Add all private identifiers to the tag file:
       jtags -i +P -c *.java 
Tag all java files in this directory and all subdirectories:
       jtags -c . 

Installation

The distribution includes source and binaries. Before installing it you should check the Makefile and make the necessary changes to adapt it to your local directory structure (it needs to know in which directory your jdk is).

Then execute

        make install
and you should now be able to use jtags.

To compile the program you need a working copy of the javac compiler plus a copy of the JavaCC compiler (a java compiler compiler). Currently there is no official download site, but if you search using a standard search engine you should have no problem finding it. It is written in 100% Java and should run on any platform. You need Version 0.7.1 (later versions should probably be OK too).

Before compiling the program you should remove all binaries and generated java files by executing

        make clean 
and then
        make 

Questions and Bug Reports

Please send questions, bug reports and fixes to
click for textversion of email address

License

I wrote this program while working for IBM. IBM allowes me to distribute the program under the following license:
(C) Copyright 1998 by International Business Machines Corporation
Written by Claudio Fleiner 

1. Ownership and License.

The Software is owned by International Business Machines Corporation or one of
its subsidiaries ("IBM") and is copyrighted and licensed, not sold. 

IBM grants you a non-exclusive, non-transferable license to download the
Software. No implied licenses are granted.

You may not merge, distribute (for free or for sale) or sublicense the Software;

2. Warranty Disclaimer and Limitation of Liability

IBM licenses the Software to you on an "as is" basis, without warranty of any
kind. IBM hereby expressly disclaims all warranties or conditions, either
express or implied, including, but not limited to, the implied warranties or
conditions of merchantability and fitness for a particular purpose. You are
solely responsible for determining the appropriateness of using this Software
and assume all risks associated with the use of this Software, including but
not limited to the risks of program errors, damage to or loss of data,
programs or equipment, and unavailability or interruption of operations. Some
jurisdictions do not allow for the exclusion or limitation of implied
warranties, so the above limitations or exclusions may not apply to you.

IBM will not be liable for any direct damages or for any special, incidental,
or indirect damages or for any economic consequential damages (including lost
profits or savings), even if IBM has been advised of the possibility of such
damages. IBM will not be liable for the loss of, or damage to, your records or
data, or any damages claimed by you based on a third party claim. Some
jurisdictions do not allow for the exclusion or limitation of incidental or
consequential damages, so the above limitations or exclusions may not apply to
you.

3. License Rights

You hereby grant to IBM an irrevocable license under all intellectual property
rights (including copyright) to use, copy, distribute, sublicense, display,
perform and prepare derivative works based upon any feedback, including
materials, fixes, error corrections, enhancements, suggestions and the like
that you provide to IBM. 

4. General

This Agreement is governed by the laws of the State of New York. 

This Agreement is the only understanding and agreement we have regarding your
use of the Software. It supersedes all other communications, understandings or
agreements we may have had prior to this Agreement. 

Download

Please include your email address if you would like to be informed about updates and bug fixes. The size of the archive file is about 110KB.

WARNING: this is beta level software and has probably still many bugs!
Use it at your own risk!

Name (optional):
eMail (optional):