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 ...
Get Learning Java, 5th 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.