Chapter 3. Tools of the Trade

While you will almost certainly do the majority of your Java development in an IDE such as VS Code or IntelliJ IDEA, all of the core tools you need to build Java applications are included in the JDK that you downloaded in “Installing the JDK”. When we write Java source code, it is the Java compiler—javac—that turns our source into usable bytecode. When we want to test that bytecode, it is the Java command itself—java—that we use to execute our programs. When we have all of our classes compiled and working together, it is the Java archive tool—jar—that allows us to bundle up those classes for distribution. In this chapter, we’ll discuss some of these command-line tools that you can use to compile, run, and package Java applications. There are many additional developer tools included in the JDK, such as jshell for interactive work or javap for decompiling class files. We won’t have time to discuss all of them in this book, but anywhere another tool might be useful, we’ll mention it. (And we will definitely be looking at jshell. It’s great for quickly trying out a new class or method.)

We want you to be comfortable with these command-line tools even if you don’t typically work in a terminal or command window. Some features of these tools aren’t easily accessible through IDEs. You may also encounter times where an IDE is impractical or downright unavailable. System administrators and DevOps engineers, for example, often have only limited, text-based connections ...

Get Learning Java, 6th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.