Java Tools Tutorials - Herong's Tutorial Notes - Version 5.30, by Dr. Herong Yang

'javac' - The Java Program Compiler

This chapter describes the Java compilation tool 'javac'. Topics include listing of 'javac' options, specifying class path with '-classpath', specifying source path with '-sourcpath', processing 'import' statements, generating debugging information with '-g'.

'javac' - Java Compilation Command and Options

Compiling Hello.java - My First Java Program

Option '-classpath' - Specifying Class Path

Option '-sourcepath' - Specifying Source Path

Option '-d' - Specifying Output Directory

Two Types of 'import' Statements

'import' Statements Processed by 'javac'

Option "-g" - Controlling Debugging Information

Conclusions:

  • "javac" is the standard compiler in JDK.
  • "-sourcepath" specifies places where to search for source definitions of new types.
  • "-classpath" specifies places where to search for class definitions of new types.
  • Two types of "import" statements behave differently with "javac".
  • Never distribute your class files with debugging information in them.

Table of Contents

 About This Book

 Java Tools Terminology

 Installing Java 8 on Windows

'javac' - The Java Program Compiler

 'java' - The Java Program Launcher

 'jdb' - The Java Debugger

 'jconsole' - Java Monitoring and Management Console

 'jstat' - JVM Statistics Monitoring Tool

 JVM Troubleshooting Tools

 jvisualvm (Java VisualVM) - JVM Visual Tool

 'jar' - The JAR File Tool

 'javap' - The Java Class File Disassembler

 'keytool' - Public Key Certificate Tool

 'native2ascii' - Native-to-ASCII Encoding Converter

 Outdated Tutorials

 References

 PDF Printing Version

'javac' - The Java Program Compiler - Updated in 2014, by Dr. Herong Yang