Stats

474 Contributors: 7 Thursday, February 9, 2017
Licensed under: CC-BY-SA
Not affiliated with Stack Overflow
Rip Tutorial: riptutorial@gmail.com
Roadmap: roadmap

Java Compiler - 'javac'

Remarks

The javac command is used for compiling Java source files to bytecode files. Bytecode files are platform independent. This means that you can compile your code on one kind of hardware and operating system, and then run the code on any other platform that supports Java.

The javac command is included in the Java Development Kit (JDK) distributions.

The Java compiler and the rest of the standard Java toolchain places the following restrictions on the code:

  • Source code is held in files with the suffix ".java"
  • Bytecodes are held in files with the suffix ".class"
  • For source and bytecode files in the file system, the file pathnames must reflect the package and class naming.

Note: The javac compiler should not be confused with the Just in Time (JIT) compiler which compiles bytecodes to native code.

Related Examples