"javac" - Java Compilation Command

This section describes 'javac', the Java compilation command, provided from the JDK (Java Development Kit) package.

The next tool used in the "ant -verbose debug" command is the "javac" tool, which comes from JDK (Java Development Kit).

If you are new to the "javac" tool, you can run it with "-help" option to get some usage information:

C:\herong\HelloAndroid>\Progra~1\Java\jdk1.8.0_45\bin\javac -help

Usage: javac <options> <source files>
where possible options include:
-g                     Generate all debugging info
-g:none                Generate no debugging info
-g:{lines,vars,source} Generate only some debugging info
-nowarn                Generate no warnings
-verbose               Output messages about what the compiler is \
                       doing
-deprecation           Output source locations where deprecated APIs \
                       are used
-classpath <path>      Specify where to find user class files and \
                       annotation processors
-cp <path>             Same as -classpath
-sourcepath <path>     Specify where to find input source files
-bootclasspath <path>  Override location of bootstrap class files
-extdirs <dirs>        Override location of installed extensions
-endorseddirs <dirs>   Override location of endorsed standards path
-proc:{none,only}      Control whether annotation processing and/or \
                       compilation is done.
-processor <class1>[,<class2>,<class3>...] Names of the annotation \
                       processors to run; bypasses default discovery \
                       process
-processorpath <path>  Specify where to find annotation processors
-d <directory>         Specify where to place generated class files
-s <directory>         Specify where to place generated source files
-implicit:{none,class} Specify whether or not to generate class files \
                       forimplicitly referenced files
-encoding <encoding>   Specify character encoding used by source files
-source <release>      Provide source compatibility with specified \
                       release
-target <release>      Generate class files for specific VM version
-version               Version information
-help                  Print a synopsis of standard options
-Akey[=value]          Options to pass to annotation processors
-X                     Print a synopsis of nonstandard options
-J<flag>               Pass <flag> directly to the runtime system
-Werror                Terminate compilation if warnings occur
@<filename>            Read options and filenames from file

The "javac" command line used by the "ant -verbose debug" command should be like this:

C:\herong\HelloAndroid>\Progra~1\Java\jdk1.8.0_45\bin\javac
-sourcepath .\src;.\gen -d .\bin\classes -classpath .\bin\classes;.\;
\local\android-sdk-windows\tools\support\annotations.jar
-target 1.5 -source 1.5
-bootclasspath \local\android-sdk...\platforms\android-15\android.jar;
\local\android-sdk...\add-ons\addon-goo...-google-22\libs\effects.jar;
\local\android-sdk...\add-ons\addon-goo...-google-22\libs\usb.jar;
\local\android-sdk...\add-ons\addon-goo...google-22\libs\maps.jar
-encoding UTF-8 -g

You can test it yourself.

Table of Contents

 About This Book

 Installing JDK 1.8 on Windows System

 Installation of Android SDK R24 and Emulator

 Installing Apache Ant 1.9 on Windows System

 Developing First Android Application - HelloAndroid

 Android Application Package (APK) Files

 Android Debug Bridge (adb) Tool

 Android File Systems

 AboutAndroid - Application to Retrieve System Information

 android.app.Activity Class and Activity Lifecycle

 View Objects and Layout Resource Files

 Using "adb logcat" Command for Debugging

Build Process and Package File Content

 "android create project" Command Options

 Android Project Folder Structure

 Android Application Project Build Process

 Project Build Process Done by "ant debug" Command

 Detailed Output of "ant -verbose debug" Command

 Output of "ant -verbose debug" - Android SDK R17

 "aapt" - Android Asset Packaging Tool

 "aapt package" Command - Resource Code Generation

"javac" - Java Compilation Command

 "dx.bat --dex" Command - Converting .class Files into .dex File

 "apkbuilder" Command - Packaging and Signing .apk File

 "zipalign" Command - Aligning File Locations in .apk Package

 "aapt dump" Command - Printing Contents of .apk Package

 META-INF Files - Digests, Signature and Certificate

 Building Your Own Web Browser

 Android Command Line Shell

 Samsung Galaxy Tab 3 Mini Tablet

 USB Debugging Applications on Samsung Tablet

 Android Tablet - LG-V905R

 USB Debugging Applications on LG-V905R Tablet

 Android Phone - LG-P925g

 USB Debugging Applications on LG-P925g Phone

 Archived Tutorials

 References

 Full Version in PDF/EPUB