Skip to main content

Java Terminologies

1. JDK (Java Development Kit)

  • The Java Development Kit (JDK) is a comprehensive software development kit used for creating Java applications.

  • It encompasses a suite of tools, executables, and libraries necessary for Java development.

  • Beyond being a compiler, the JDK provides everything developers need to write, compile, and run Java code.

Components of JDK:

  1. Compiler (javac): Transforms Java source code (.java files) into bytecode (.class files).

  2. Java Virtual Machine (JVM): Executes bytecode on the target platform.

  3. Java Runtime Environment (JRE): Includes libraries, binaries, and files essential for running Java applications.

  4. JavaDoc: A tool for generating API documentation from source code comments.

  5. Debugger, Profiler, and Other Tools: Aids in debugging and profiling Java applications.

2. JRE (Java Runtime Environment)

  • The Java Runtime Environment (JRE) is a subset of the JDK, designed solely for running Java applications.

  • It provides the minimal set of tools and libraries required for executing Java bytecode.

  • Users who only need to run Java applications can install the JRE without the full suite of development tools.

Components of JRE:

  1. Java Virtual Machine (JVM): Executes Java bytecode.

  2. Java Core Libraries: A set of libraries and APIs for common tasks.

  3. Java Plugin: Facilitates the running of Java applets in web browsers.

  4. Java Web Start: Enables the launching of Java applications directly from the web.

3. JVM (Java Virtual Machine)

  • The Java Virtual Machine (JVM) is a critical component of the Java platform.

  • It acts as an intermediary layer between Java bytecode and the underlying hardware and operating system.

  • JVM is responsible for executing Java bytecode, making Java a platform-independent language.

Key Functions of JVM:

  1. Loading: Loading the bytecode (compiled Java source code) into memory.

  2. Verification: Ensuring the bytecode adheres to Java's safety and security rules.

  3. Execution: Executing Java bytecode line by line.

  4. Garbage Collection: Managing memory by identifying and collecting unused objects.

  5. JIT Compilation: Just-In-Time compilation translates bytecode into machine code for improved performance.

4. Bytecode

  • Java source code is compiled into an intermediate form called bytecode.

  • Bytecode is a set of instructions understood by the Java Virtual Machine (JVM).

  • It is platform-independent and can be executed on any device with a compatible JVM.

Advantages of Bytecode:

  1. Portability: Bytecode can be executed on any device with a JVM, ensuring "write once, run anywhere" capability.

  2. Security: Bytecode is verified by the JVM, reducing the risk of security vulnerabilities.

  3. Performance: Bytecode is translated into machine code by the JVM's Just-In-Time compiler, optimizing execution.

5. Garbage Collection

  • Garbage Collection is the automatic process in Java that manages the memory used by a program.
  • In Java, developers do not explicitly deallocate memory instead, the Garbage Collector identifies and frees up memory occupied by objects that are no longer in use.

Key Aspects of Garbage Collection:

  1. Mark and Sweep: The Garbage Collector identifies and marks objects that are still reachable. It then sweeps through and deallocates memory occupied by unreferenced objects.

  2. Generational GC: Objects are divided into different generations (young and old). Young generation collects short-lived objects, while the old generation handles longer-lived objects.

  3. Parallel and Concurrent GC: Garbage Collection can be executed concurrently with the application or in parallel with multiple threads, minimizing the impact on application performance.