What is the command-line tool used to convert Java source code into bytecode?

The story behind the answer

The command-line tool used to convert Java source code into bytecode is javac.

`javac` is the Java programming language compiler supplied with the Java Development Kit. It reads source files, usually ending in `.java`, checks them against Java language rules, resolves required types, and normally writes `.class` files containing Java Virtual Machine bytecode. The JVM can then execute those class files or load them as part of a larger application.

A typical command is `javac HelloWorld.java`. The compiler can place generated classes in another directory with `-d`, and modern JDKs provide options such as `--release` to target a particular Java platform release. Compilation may also perform annotation processing and report warnings or errors.

The other options are related Java tools but have different jobs. `java` launches a class or application, `jar` packages files into an archive, and `javadoc` generates API documentation from source comments. A useful distinction is that javac compiles, while java runs the resulting program.

Source: Wikipedia · fact-checked Aug. 2026

Add question to a list

Choose a list to keep this question in: