Team LiB
Previous Section Next Section

aptAnnotation Processing Tool


apt [options] sourcefiles


apt reads and parses the specified sourcefiles. Any annotations it finds are passed to appropriate annotation processor factory objects, which can use the annotations to produce auxiliary source or resource files based on annotation content. apt next compiles sourcefiles and generated files.

Annotation processor classes and factory classes are defined with the com.sun.mirror.apt API and other subpackages of com.sun.mirror.


apt shares several options with javac. If a command-line argument begins with @, apt treats it as a file and reads options and source files from that specified file. See javac for more on this.

-A name=value

Passes the name=value pair as an argument to annotation processors.

-cp path

-classpath path

Sets the classpath. See javac.

-d dir

The directory under which to place class files. See javac.

-factory classname

Explicitly specifies the class name of the annotation processor factory to use.

-factorypath path

A path to search for annotation processor factories instead of searching the classpath.


Prints usage information and exits.


Tells apt not to compile the sourcefiles or any generated files.


Simply parses the specified sourcefiles and prints a synopsis of the types they define. Does not process annotations or compile any files.

-s dir

Specifies the root directory beneath which generated source files will be stored.

-source version

Specifies what version of the language to accept. See javac.


Prints apt version information.


Displays information about nonstandard options.

See also

javac, Chapter 4

    Team LiB
    Previous Section Next Section