The Java Development Kit (JDK) provides the foundation upon which all applications that are targeted toward the Java platform are built. The JDK includes a variety of tools and utilities that perform a variety of tasks, which include compiling source code into bytecode, packaging applications, spinning up Java virtual machines (JVMs) and managing the runtime environment of Java applications.
What is the JDK?
The JDK is a software package that contains a variety of tools and utilities that make it possible to develop, package, monitor and deploy applications that build for any standard Java platform, including Java Platform, Standard Edition (Java SE); Java Platform, Micro Edition (Java ME); and Java Platform, Enterprise Edition (Java EE).
The Java platform
In the past, it would have been correct to say that the JDK specifically targeted the program language Java. However, Java 7 introduced a special constructs that made it much easier for peripheral programming languages, such as Groovy, Clojure or Kotlin, to compile into Java bytecode and execute using the Java Runtime Environment (JRE). As a result, the Java platform as it exists today includes not only Java, but a variety of other peripheral languages that use the JDK tools and execute on the Java runtime.
JDK components, tools and utilities
The bin directory of the JDK provides a variety of features and tools that aid in the software development process. Some of the more popular JDK utilities include:
- javac: This utility is used to compile Java source code into Java bytecode.
- rmic: This utility creates skeletons and stubs for use in Remote Method Invocation (RMI).
- jar: This compression utility aggregates a multitude of files into a single Java ARchive (JAR) file. The jar utility uses a standard compression algorithm used by all of the most common zip utilities.
- javadoc: This utility can examine the names of classes and the methods contained within a class, as well as consume special annotations in order to create application programming interface (API) documentation for Java code.
- wsgen: This generates various artifacts required by Java API for XML Web Services (JAX-WS).
- javap: This utility disassembles class files, generating information about the methods, properties and attributes of a given compiled component.
The JDK also contains a number of tools for inspecting the runtime behavior of a JVM, including Java Mission Control (JMC), Java Flight Recorder (JFR) and VisualVM.
Difference between the JDK and JVM
Within the JDK bin directory, there is also a utility simply named java. This utility will take any Java application containing a runnable main method and execute it as a software program. When a Java application's source code is compiled, it is compiled into bytecode. Bytecode is an intermediary between Java source code and low-level machine code. When the java utility is invoked, a JVM is created, which uses a just-in-time (JIT) compiler to convert bytecode into machine code. This on-the-fly conversion from Java bytecode to low-level computer instructions is the key to making a Java application cross-platform and hardware-agnostic.
JDK vs. JRE comparison
When downloading and installing Java, there are two possible options. The first option is to download and install the JRE, and the second is to download and install the JDK. Any program written in Java that does not need any extra features other than the standard set of Java libraries and a simple execution environment will run successfully on the JVM provided by the JRE. However, if any supplemental features, like the need to compile Java source code on the fly or generate an authentication certificate, are necessary, then the JDK would be required. The JDK includes a JRE of its own but provides a variety of extra features over and above the basic facilities of the JRE.
Some products that require the installation of the JDK rather than the JRE include Jenkins, Maven, IBM WebSphere, JMeter, Tomcat and Apache Karaf.
Learn how to install Java and the JDK
Java SE and the JDK
The JDK is packaged with all of the libraries that are defined by Java SE. The standard APIs include packages for utilities, networking, input/output (I/O), cryptography and XML processing. The JDK also includes the SE support for user interface (UI) development with Abstract Window Toolkit (AWT), Swing and JavaFX packages.
However, the JDK does not include support for components such as servlets, Java ServerPages (JSP) and Enterprise JavaBeans (EJB). These components are part of the Java EE platform, which is built on top of Java SE. Similarly, the JDK does not have inherent support for microdevice development with Java ME, although Java ME does build on top of and utilize all of the features and tools that are made available through the JDK. The JDK represents a core set of libraries, utilities and tools that Java developers can use. Subsequent APIs, platforms and frameworks that are built with Java all build upon the facilities provided by the JDK.
Peripheral programming languages, such as Groovy, Clojure, Scala and Kotlin, continue to gain in popularity. These languages all run on the JDK but provide various features that overcome the limitations of the Java language. For example, Groovy provides strong scripting features. Scala and Clojure solve various scalability issues the Java program runs into. And Kotlin greatly simplifies Android application development. All of these languages run on a JVM and take advantage of the standard libraries and other features that are built into the Java platform.
With over 20 years of availability, the JDK has proven itself reliable enough to withstand the most extreme environments and workloads, and with its ability to support new languages that add extra functionality over and above that of the Java language itself, the JDK will inevitably be a major player in the IT world for years to come.