javac - The Java compiler

In this article we are going to elaborate the javac command tool which is a part of JAVA commands (comes with jdk package). This article is the continuation of this previous article.

As we know the standard format of commands in java, the javac command also have the format(in command prompt).

javac [options] [sourcefiles/list of source files in a file] [arguments/argument files]

javac reads definitions(classes/interfaces) written in the Java and compiles them into bytecode(class files).
When we use file name as input parameter(for list of class/interface/arguments) , we need to add @ before the file path. Example :
javac @path1\options @path2\classes


Javac Options : See the option details from this post . I am listing the option names only which are present in java tool.

Standard Options : 
-classpath [class path Name]:(or cp) Same as java tool
-d directory : Same as java tool
-verbose: Same as java tool
-sourcepath [source path] : Specify the source code path(class/interface definitions)
-deprecation : Shows description of each use or override of a deprecated member or class
-encoding [encoding Name]: Sets the source file encoding name

-g : Generate all debugging information, including local variables
-g:{keyword list}:Generates some kinds of debugging information(comma separated input)
source : Source file debugging information
lines: Line number debugging information
vars : Local variable debugging information
none : Does not generate any debugging information

-nowarn : Disable warning messages
-source [release] : Enables support for compiling source code with specific release
-target [version]: Generate class files that will work on VMs with the specified version
-J[option] : Passes option to the java launcher by javac

Cross-Compilation Options :
-target [version] : Generate class files that will work on VMs with the specified version
-bootclasspath [boot class path] : Cross-compile against the specified set of boot classes
-extdirs [directories] : Cross-compile against the specified extension directories

Non-Standard Options :
-X : Display information about non-standard options(Same as java tool).
-Xstdout [filen ame] : Send compiler messages to the named file
-Xswitchcheck : Checks switch blocks for fall-through cases and provides a warning message for any that are found.

Thanks....:)

No comments:

Post a Comment