1. How do I use Jikes? What options does it support?

2. How does Jikes support incremental compilation?

3. Is Jikes related to Visual Age Java?

4. How do I use Jikes to generate dependencies for make?

5. How does Jikes process programs differently from other compilers?


1. How do I use Jikes? What options does it support?

You can use Jikes the same way you use most Java compilers. It supports most of the commonly used options. You can invoke it with no arguments to get a brief description of the options you can use. The supported options are:
-ggenerate LocalVariableTable attribute

-Odo not generate LineNumberTable attribute

-debugno effect (recognized for compatibility with many compilers)

-dependrecompile all used classes

-nowarnsuppress warning messages

-verboselist files read and written

-classpath pathset classpath

-nowritedo not write any class files

-d dirwrite class files in specified directory

++compile in incremental mode

Go by the book (see FAQ included with download for details).

+Dsuppress checking of definite assignment

+Elist errors in a form commonly used by emacs to scan for errors. By default errors are listed in a more readable form.

+Fdo full check for dependencies

+Mgenerate makefiles with dependencies

[Goto Top]

2. How does Jikes support incremental compilation?

Jikes can be run in an incremental mode that works as follows:

Open a window and compile your program using

jikes ++ Main.java

where Main.java denotes your root source file. Jikes will then compile Main.java and all the files it references, building a complete set of dependencies, and will then wait for input. Modify your source files using your favorite editor until you are ready to rebuild your program, and then type an empty line in the window in which Jikes is waiting. Jikes will then determine which source files have been changed, and will then perform the minimum number of compilations needed to bring the class files into a complete and consistent state. You can repeat this cycle as you wish, until you terminate the compilation by typing a single line: q in the window in which Jikes is waiting.
Zip files in CLASSPATH are assumed to be unchanging, and are not included in the dependency analysis. This limits the number of class files that must be read.

[Goto Top]

3. Is Jikes related to Visual Age Java?

As you may know, IBM has a VisualAge Java development system in beta test. The Jikes compiler project is not part of the VisualAge system, but either or both of these IBM efforts might be helpful to your Java development. Note that both these efforts conform to the same version of Java, namely that defined in the open, published specifications. VisualAge for Java will be a comprehensive, integrated development environment with lots of state-of-the art features ([Take a peek!]).The scope of Jikes is smaller: it compiles .java files to .class files. We think Jikes will be useful to you if you have a collection of Java development tools that you are satisfied with but you need a fast compiler that implements the Java language specification accurately.

[Goto Top]

4. How do I use Jikes to generate dependencies for make?

Use the +M option to request that Jikes create a file X.u for each file X.class that is compiled, and include a list of all the files that X.class depends on. Zip files in CLASSPATH are assumed to be unchanging, and are not included in the generated makefiles, mainly to avoid cluttering up the dependency list with voluminous dependencies on the contents of java.*.

[Goto Top]

5. How does Jikes process programs differently from other compilers?

Here are a few examples of constructs that Jikes handles according to specifications. See the FAQ included in the download for more examples. [

Extraneous Semicolons. Your program may contain extraneous semicolons that are silently ignored by many compilers. Jikes treats then as cause to issue a warning. You can use the -nowarn option to suppress these warnings.

Unreachable Statements. It is a compile-time error if a statement cannot be executed because it is unreachable (section 14.19). Many compilers don't properly detect unreachable statements, and accept programs such as the following (which Jikes rejects):

class Test {
void method(boolean b) {
     if (b) return;
     else return;
     b = !b;
}
}
Another example, and one that confuses many users, is shown by the following program:

class Test {
public static void main(String[ ] args){
   try {
   }
   catch (Exception e) {
     System.out.println("caught");
   }
}
}

Jikes accepts this program but issues the warning:

catch (Exception e) { <---------> *** Warning: This catch block is unreachable: there is no exception whose type is assignable to "java/lang/Exception" that can be thrown during execution of the body of the try block.

See Section 14.1: since execution of the (empty) try block can throw no exception, the catch block is not reachable. Jikes will detect similar errors, even when the try block is not empty, based on its analysis of the program. (This is one area where the specification is a bit murky, and this murkiness is the reason Jikes treats this as cause for issuing a warning and not an error.)

Definite Assignment. Some compilers accept the following program:

public class Test {
public static void main(String args[ ]) {
      L1: for (int i = 1;  i < 11;  i++) {
           int j = 1,
           k;
           L2:
            do {
                    if (j == i)
                         continue L1;
                         j++;
                         k = 0;

                    } while (j < 10);
                      int l = k; // an error should be emitted here !
             }
       }
}

which Jikes rejects:

int l = k; // an error should be emitted here !

*** Semantic Error: The variable "k" is accessed before having been definitely assigned a value

Problems with break Statement. Many compilers have trouble with the following program. Some crash during compilation; others complain about a missing label:


class Test {
public static void main(String[ ] args) {
     Label:
     try {
     }
     finally {
         break Label;
     }
}
}
Jikes accepts this program.

[Goto Top]