# Annotation Processing

## `javac` annotation processing

As an improvement for the `apt` Pluggable Annotation Processing API was introduced in Java SE 6. It provides an API to allow the processing of JSR 175 annotations (metadata); this will require modeling elements of the Java TM programming language as well as processing-specific functionality.

The `javac` generates the portable artifacts used in JAX-WS services.

## `javac` Annotation Processing Syntax

                javac

                    JAVAC_OPTION

                    SOURCE_FILE

The following table lists the `javac` options useful for annotation processing:

Option | Description
`-classpath <path>` | Specifies where to find user class files and annotation processor factories.
`-d <path>` | Specifies where to place processor generated class files.
`-s <path>` | Specifies where to place processor generated source files.
`-source <release>` | Provide source compatibility with the specified release.
`-Xprint` | Print out textual representation of specified types for debugging purposes; perform neither annotation processing nor compilation. The format of the output may change.
`-XprintProcessorInfo` | Print information about which annotations a processor is asked to process.
`-XprintRounds` | Print information about initial and subsequent annotation processing rounds.
`-A[key[=value]]` | Options to pass to annotation processors.
`-proc:{none,only}` | Control whether annotation processing and/or compilation is done.
`-sourcepath <path>` | Specify where to find input source files.
`-endorseddirs <dirs>` | Override location of endorsed standards path.
`-processor <class1>[,<class2>...]` | Names of the annotation processors to run; bypasses default discovery process
`-processorpath <path>` | Specify where to find annotation processors

More options and detailed information on `javac` can be found here.

It is important when using `javac` with JAX-WS to specify all of the JAR files in the distributed JAX-WS bundle in the classpath passed to `javac`. As JAX-WS annotation processor you have to specify `com.sun.tools.ws.processor.modeler.annotation.WebServiceAp`. The `-sourcepath <path>` option must also be provided so that `javac` and the JAX-WS annotation processor can find all types referenced by a web service endpoint implementation class. In case you don't have additional annotation processors it's recommended to use tools-annotation-processing-ant-task.