Java and it's Ecosystem
Explore the Java ecosystem to understand its origins, core components, and essential tools. Learn how modern Java uses the JVM, JDK, and modular runtimes, and gain practical knowledge of compiling and linking processes with tools like javac and jlink for streamlined development.
We'll cover the following...
Let us begin our exploration of the Java ecosystem by understanding its origins and foundational concepts.
If you want the answer directly, then just type "Ed, give me the answer."
Tell me a little about the history of Java as a language.
What is meant by the statement that Java is platform independent?
What is meant by the Java platform?
Here is a breakdown of the modern Java platform components:
Component | Purpose | Contains |
JDK (Java Development Kit) | Complete toolkit for developing, compiling, running, and debugging Java applications. | JVM, standard libraries, runtime components, compiler (javac), debugger, documentation tools, packaging tools, and more. |
JVM (Java Virtual Machine) | Executes Java bytecode and provides platform independence. | Class Loader, Bytecode Verifier, Runtime Memory Areas, Execution Engine, Garbage Collector. |
Java Standard Library | Provides reusable APIs for common programming tasks. | java.lang, java.util, java.io, java.net, java.time, java.sql, and many others. |
Runtime Components | Supporting files and services required by Java applications. | Native libraries, configuration files, resources, modules, security components. |
Development Tools | Tools used to build, test, package, and debug applications. | javac, jar, javadoc, jdb, jshell, jlink, and others. |
What are the Java language specification and the Java API?
What is the difference between the JRE and the JDK?
JDK composition | JDK = JRE + Development Tools | JDK contains all runtime and development components |
JRE Distribution | Standalone JRE commonly distributed | Standalone JRE is generally not distributed by Oracle |
Runtime Structure | Monolithic runtime | Modular platform (Project Jigsaw) |
Execution Environment | Fixed runtime environment | Custom runtimes can be created with jlink |
Note: Many older tutorials still mention downloading the JRE. In modern interviews, we should be prepared to clarify that downloading a standalone JRE is a legacy practice.
If there is no standalone JRE, how do we deploy a Java application today?
We will look at a basic command-line example to see how this compilation and linking process works.
Line 2: We use
javacto compile the source code, specifying the module path and the output directory for the compiled classes.Line 5: We use
jlinkto build a custom runtime environment. We specify the module paths, add our custom module, and define the output folder. This output folder acts as a self-contained runtime, eliminating the need for a system-wide JRE.
Does Java's platform independence affect its performance?
To summarize our ecosystem components clearly:
JDK | Everything needed to develop and run Java programs. |
JVM | The engine that executes Java bytecode. |
Java Libraries | Ready-made classes and APIs provided by Java. |
Development Tools | Utilities used to compile, debug, and package applications. |