Java translation command-line syntax

To translate Java code, all types defined in a library that are referenced in the code must have a corresponding definition in the source code, a class file, or a JAR file. Include all source files on the OpenText SAST command line.

If your project contains Java code that refers to Kotlin code, make sure that the Java and Kotlin code are translated in the same OpenText SAST instance so that the Java references to Kotlin elements are resolved correctly. Kotlin to Java interoperability does not support Kotlin files provided by the –sourcepath option. For more information about the –sourcepath option, see Java command-line options

The basic command-line syntax to translate Java code is shown in the following example:

sourceanalyzer -b <build_id> -cp <classpath> <files>

With Java code, OpenText SAST can either:

For information about how to integrate OpenText SAST with Ant, see Integrating with Ant.

To have OpenText SAST emulate the compiler, type:

sourceanalyzer -b <build_id> javac [<translation_options>]

To pass files directly to OpenText SAST, type:

sourceanalyzer -b <build_id> -cp <classpath> [<translation_options>] 
<files> | <file_specifiers>

where:

For descriptions of all the available Java-specific command-line options, see Java command-line options.