Skip to Content
Learning Java, 5th Edition
book

Learning Java, 5th Edition

by Marc Loy, Patrick Niemeyer, Daniel Leuck
March 2020
Beginner
515 pages
15h
English
O'Reilly Media, Inc.
Content preview from Learning Java, 5th Edition

Chapter 3. Tools of the Trade

While you will almost certainly do the majority of your Java development in an IDE such as Eclipse, VS Code, or (the author’s favorite) IntelliJ IDEA, all of the core tools you need to build Java applications are included in the JDK that you have likely already downloaded in “Installing the JDK” from Oracle or another OpenJDK provider.1 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 that we’ll discuss throughout this book.

For more details on IntelliJ IDEA and instructions for loading all of the examples in this book as a project, see Appendix A.

JDK Environment

After you install Java, the core java runtime command may appear in your path (available to run) automatically. However, many of the other commands provided with the JDK may not be available unless you add the Java bin directory to your execution path. The following commands show how to do this on Linux, macOS, and Windows. You will, of course, have to change the path to match the version of Java you have installed.

# Linux
export JAVA_HOME=/usr/lib/jvm/java-12-openjdk-amd64
export PATH=$PATH:$JAVA_HOME/bin

# Mac OS X
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-12.jdk/Contents/Home
export PATH=$PATH:$JAVA_HOME/bin

# Windows
set JAVA_HOME=c:\Program Files\Java\jdk12
set PATH=%PATH%;%JAVA_HOME%\bin

On macOS, the situation may be more confusing ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learning Java, 4th Edition

Learning Java, 4th Edition

Patrick Niemeyer, Daniel Leuck
Learning Java, 6th Edition

Learning Java, 6th Edition

Marc Loy, Patrick Niemeyer, Daniel Leuck
Java in a Nutshell, 7th Edition

Java in a Nutshell, 7th Edition

Benjamin J. Evans, David Flanagan
Head First Java, 2nd Edition

Head First Java, 2nd Edition

Kathy Sierra, Bert Bates

Publisher Resources

ISBN: 9781492056263Errata PageSupplemental Content