Tag Archives: JDK

JDK, JRE, JIT,SDK, JVM Introduction


JDK (Java  Development Kit)

JDK (Java Development Kit) is a superset of JRE (Java Runtime Environment), it contains everything that JRE has along with development tools such as compiler, debugger, etc.

JDK Java development Kit
Java Development Kit

See Also: Java: Program Execution

JRE (Java Runtime Environment)

JRE (Java Runtime Environment) provides the environment in which the JVM (Java Virtual Machine) runs. JRE contains JVM, class libraries, and other files excluding development tools such as compiler and debugger.

It means, you can run the code in JRE but you can’t develop and compile the code in JRE.

JDK and JRE Formulae

JVM (Java Virtual Machine)

JVM (Java Virtual Machine) runs the program by using class, libraries, and files provided by JRE. JVM able to run a program written in Java and other languages also that are compiled to Java byte code. For Example Jython, Jruby, Closure, Apache, Groovy, Kotlin, etc.

JVM Architecture

Now discussed terminology used for JVM.

Class Loader

The class loader reads the .class file and saves the byte code in the method area.

Method Area

Method area holds class level information of .class file. JVM jave only one method area which is shared among all the classes.

Heap

Heap is a JVM memory part where objects are allocated. JVM creates an object for each .class Class file.

Stack

The stack is  JVM memory part but unlike Heap, it is used for storing temporary variables i.e method parameters.

PC Registers

PC Registers use to keeps the track of which instruction has been executed and which one is going to be executed. Because instructions are executed by threads, each thread has a separate PC register.

JIT Compiler

The JIT also called a Just-In-Time compiler. It used when a method is called. The JIT compiles the bytecode of that called method into native machine code. When a method has been compiled in native machine code, the JVM calls the compiled code of that method directly instead of interpreting it.

Native Method Stack

A native method used to access the runtime data areas of the virtual machine.

Native Method interface

It enables java code to call or be called by native applications wiritten in C or C++. Native applications are programs in low-level language that is specific to the hardware and OS of a system.

Garbage collection

Garbage Collection use for automatic memory management by JVM. It destroys unreferenced objects from Heap so that allocates more memory for new objects.

JDK Architecture & API’s Details

In this figure, you will get an idea of how these libraries and API’s are distributed on different levels.

JDK APIs Architecture

Difference between API and Methods

API (Application Programming Interface) interfaces that the rest of the world sees and can use. A Method can be part of the public interface or not. But an API executes a set of methods.

In java, APIs provide through the interface which is really a set of public methods. An API has contract like tells about method signatures and return type.

For Example List API’s provide different method signature and expected result as return type so that you can use according to your convenience.

Difference between JDK and SDK

JDK(Java Development Kit) is an extended subset of a SDK (Software Development Kit).

  • JDK includes tools for developing, debugging and monitoring of Java Program. It mainly responsible for the writing and running of Java programs.
  • SDK is composed of extra software related to a Web application or mobile application etc. such as Application Server, Documentation, Debuggers, Code Samples, Tutorials, GlassFish server, MySQL and IDE Netbeans.

Now, Oracle strongly suggests using the term JDK to refer to the Java SE Development Kit. The Java EE SDK is now available with or without the JDK, by which they specifically mean the Java SE 7 JDK.

See Also: Java Versions History

 

Java: Versions History


Here is a list of all versions of Java and features introduced with each release.

JDK Alpha and Beta

The Java Alpha and Beta version was released in 1995 but they have highly unstable APIs. The supplied Java web browser was named Web-Runner.

JDK 1.0

Java’s first stable version 1.0.2 was released on January 23, 1996. Its code name was Oak and called as java 1.

JDK 1.1

JDK 1.1 version was released on February 19, 1997. It was having some additional features as :

  • The concept of Inner Class
  • Java Beans
  • JDBC
  • RMI
  • The AWT event model was totally reshaped.
  • Reflection (which supported Introspection only, the modification was not possible at run time).
  • JIT (Just In Time) compiler added on Microsoft Windows platforms to produced for JavaSoft by Symantec
  • Internationalization and Unicode support originating from Taligent.

J2SE 1.2

JDK 1.2 version was released on December 8, 1998, called code-name Playground. It was a very big release and replaced JDK to recognize the base platform from J2EE and J2ME. It was having so many additional features as

  • strictfp keyword
  • Java plug-in
  • Java IDL, an IDL implementation for CORBA interoperability
  • Collections framework
  • Core classes added some new Swing graphical API.
  • Sun’s JVM was added with a JIT compiler for the first time to enhance performance.

J2SE 1.3

JDK 1.3 version was released on May 8, 2000, called code-name Kestrel. It was having so many additional features as

  • HotSpot JVM included.
  • RMI was updated to support optional compatibility with CORBA.
  • JNDI (Java Naming and Directory Interface).
  • Java Platform Debugger Architecture (JPDA) included.
  • JavaSound.
  • Synthetic proxy classes.

J2SE 1.4

JDK 1.4 version was released on February 6, 2002, called code-name Merlin. It was first Java Platform which was released under the Java community process and having so many additional features as

  • Improved libraries.
  • Perl regular expressions included.
  • Provided exception chaining (It allows an exception to encapsulate original lower-level exception).
  • IPv6 support (Internet Protocol version 6).
  • Logging API (Specified in JSR 47.)
  • The image I/O API for reading and writing images in formats like JPEG and PNG.
  • XML parser and XSLT processor integrated.
  • Security and cryptography extensions (JCE, JSSE, JAAS) integrated.

J2SE 5.0

J2SE 1.5 version was released on September 30, 2004, called as code-name Tiger also called as Java 5.0. It was having so many additional features as

  • It provided compile-time type safety for collections by using generics and eliminates the need for most typecasts.
  • Used Metadata or annotations.
  • Auto-boxing/unboxing.
  • Enumerations.
  • Enhanced for each loop.
  • Improved semantics of execution for multi-threaded Java programs.
    Static imports.
  • There were also some improvements in standard libraries:
  • Automatic stub generation for RMI objects.
  • Swing: It provided a skinny look and feel.
  • The concurrency utilities in package java.util.concurrent.
  • Scanner class added for parsing data from various input streams and buffers.
  • Java 5 was the last release of Java which officially supported the older versions Microsoft Windows 9x line i.e (Windows 95, Windows 98, Windows ME) and window Vista
  • Apple Mac OS X 10.5 by default having java version 5 installed.

Java SE 6

Java SE version was released on December 11, 2006, called as code-name Mustang also called as Java SE 6. It was having so many additional features as

  • Dropped the support for older Win9x versions.
  • Scripting Language Support.
  • Generic API for tight integration with scripting languages.
  • Improved Web Service support.
  • JDBC 4.0 support.
  • Now invoke Java Compiler by using Java Compiler API pro-grammatically.

Java SE 7

Java SE version was released on July 28, 2011, called code-name Dolphin also called as Java SE 7. It was having so many additional features as

  • JVM support for dynamic languages.
  • Compressed 64-bits pointer.
  • Strings added in the switch.
  • Automatic resource management in try-statement.
  • Underscores allowed in numeric literals.
  • Binary integer literals.
  • Improved type interface for creating a generic instance. (also called diamond operator )
  • Improved caching and throwing. (catch multiple exceptions and re-throw with improved type checking)
  • Provided Java Deployment rule sets.

Java SE 8

Java SE version was released on March 18, 2014, called code-name Spider. It was having so many additional features as

Java SE 9

Java SE version was released on September 21, 2017, developed by Oracle. It was having so many additional features as

  • Java 9 would include better support for better native code integration, multi-gigabyte heaps, a different default garbage collector and a self-tuning JVM.
  • Modularization of the JDK under Project Jigsaw.
  • Provided Money and Currency API.
  • Tight integration with JavaFX.
  • Java implementation of reactive streams.
  • More Concurrency Updates.
  • Provided Java Linker.
  • Automatic scaling and sizing.

Java SE 10

Java SE version was released on March 20, 2018, developed by Oracle. It was having so many additional features as

  • Remove primitive data types and move towards 64-bit addressable arrays to support large data sets.
  • Local-Variable Type Inference
  • Experimental Java-Based JIT Compiler: This is a Graal dynamic compiler to the integration with the Linux x64 platform.
  • Application Class-Data Sharing: This reduces the startup and footprint for java applications by placing application classes in shared archives.
  • Time-Based Release Versioning
  • Parallel Full GC for G1
  • Garbage-Collector Interface
  • Additional Unicode Language-Tag Extensions
  • Root Certificates
  • Thread-Local Handshakes
  • Heap Allocation on Alternative Memory Devices
  • Remove the Native-Header Generation Tool – javah
  • Consolidate the JDK Forest into a Single Repository

Java SE 11

Java SE version was released on September 25, 2018, and the version is open for bug fixes. It was having so many additional features as

  • JEP 309: Dynamic class-file constants
  • JEP 318: Epsilon: a no-op garbage collector
  • JEP 323: Local-variable syntax for lambda parameters
  • JEP 331: Low-overhead heap profiling
  • JEP 321: HTTP client (standard)
  • JEP 332: Transport Layer Security (TLS) 1.3
  • JEP 328: Flight recorder
  • JEP 333: ZGC: a scalable low-latency garbage collector
  • CORBA, JavaFX, and  Java EE modules have been removed from JDK
  • JEP 335: Deprecated the Nashorn JavaScript engine
  • Unicode 10.0.0 support (while the current version is Unicode 11.0.0, it’s only in Java 12)
  • Java web start and applets are no longer available.

Java SE 12

Java SE version was released on March 19, 2019, and the version is open for bug fixes. It was having so many additional features as

  • JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector
  • JEP 230: Microbenchmark Suite
  • JEP 325: Switch Expressions
  • JEP 334: JVM Constants API
  • JEP 340: One AArch64 Port, Not Two
  • JEP 341: Default CDS Archives
  • JEP 344: Abortable Mixed Collections for G1
  • JEP 346: Return Unused Committed Memory from G1 Promptly

Java SE 13

Java SE version was released on Sep 19, 2019, and the version provided lots of bug fixes and also includes many additional features as

  • JEP-350: Dynamic CDS Archives
  • JEP-351: ZGC: Uncommit Unused Memory
  • JEP-353: Reimplement the Legacy Socket API
  • JEP-354: Switch Expressions (Preview Feature)
  • JEP-355: Text Blocks (Preview Feature)
  • FileSystems.newFileSystem() Method
  • Dom and SAX Factories with Namespace Support
  • Support for Unicode 12.1

Java SE 14

JAVA SE version was released on March 17, 2020, and the version provided following main features and bug fixes.

  • JEP 305: Pattern Matching for instanceOf
  • JEP 343: Packaging Tool
  • JEP 345: NUMA-Aware Memory Allocation for G1
  • JEP 349: JFR Event Streaming
  • JEP 352: Non-Volatile Mapped Byte Buffers
  • JEP 358: Helpful NullPointerExceptions
  • JEP 359: Records
  • JEP 361: Switch Expressions
  • JEP 362: Deprecate the Solaris and SPARC Ports
  • JEP 363: Remove the Concurrent Mark Sweep (CMS) from Garbage Collector
  • JEP 364: ZGC on macOS
  • JEP 365: ZGC on Windows
  • JEP 366: Deprecate the ParallelScavenge + SerialOld GC Combination
  • JEP 367: Remove the Pack200 Tools and API
  • JEP 368: Text Blocks
  • JEP 370: Foreign-Memory Access API

Java SE 15

JAVA SE version was released on September 17, 2020, and the version provided following main features and removed some of the features like Shenandoah and Z Garbage collectors, CA certificate, Nashom Java script etc.

  • JEP 339: Edwards-Curve Digital Signature Algorithm (EdDSA)
  • JEP 360: Sealed Classes
  • JEP 371: Hidden Classes
  • JEP 372: Remove the Nashorn JavaScript Engine
  • JEP 373: Reimplement the Legacy DatagramSocket API
  • JEP 374: Disable and Deprecate Biased Locking
  • JEP 375: Pattern Matching for instanceof
  • JEP 377: ZGC: A Scalable Low-Latency Garbage Collector
  • JEP 378: Text Blocks
  • JEP 379: Shenandoah: A Low-Pause-Time Garbage Collector
  • JEP 381: Remove the Solaris and SPARC Ports
  • JEP 383: Foreign-Memory Access API
  • JEP 384: Records
  • JEP 385: Deprecate RMI Activation for Removal

Java SE 16

JAVA SE version was released on March 16, 2021, and the version provided following main features and also removed Ahead-of-time compilation. Java itself was and written in C++14 and code was moved to github.

  • JEP 338: Vector API
  • JEP 347: Enable C++14 Language Features
  • JEP 357: Migrate from Mercurial to Git
  • JEP 369: Migrate to GitHub
  • JEP 376: ZGC: Concurrent Thread-Stack Processing
  • JEP 380: Unix-Domain Socket Channels
  • JEP 386: Alpine Linux Port
  • JEP 387: Elastic Metaspace
  • JEP 388: Windows/AArch64 Port
  • JEP 389: Foreign Linker API
  • JEP 390: Warnings for Value-Based Classes
  • JEP 392: Packaging Tool
  • JEP 393: Foreign-Memory Access API
  • JEP 394: Pattern Matching for instanceof
  • JEP 395: Records
  • JEP 396: Strongly Encapsulate JDK Internals by Default
  • JEP 397: Sealed Classes

Java SE 17

JAVA SE version is expected to released on September, 2021, and the version will provide the following main features. This release will be long terms support release after Java SE 11.

  • JEP 306: Restore Always-Strict Floating-Point Semantics
  • JEP 356: Enhanced Pseudo-Random Number Generators
  • JEP 382: New macOS Rendering Pipeline
  • JEP 391: macOS/AArch64 Port
  • JEP 398: Deprecate the Applet API for Removal
  • JEP 403: Strongly Encapsulate JDK Internals
  • JEP 406: Pattern Matching for switch
  • JEP 407: Remove RMI Activation
  • JEP 409: Sealed Classes
  • JEP 410: Remove the Experimental AOT and JIT Compiler
  • JEP 411: Deprecate the Security Manager for Removal
  • JEP 412: Foreign Function & Memory API
  • JEP 414: Vector API
  • JEP 415: Context-Specific Deserialization Filters

References

https://en.wikipedia.org/wiki/Java_version_history

[Solved] Maven: No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK


This maven exception occurs  when your Window/Unix environment variable for JAVA_HOME and PATH are pointing to JRE instead of JDK. That’s why maven will not compile code and throw below exception.

Problem

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building SpringBootApp 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-install-plugin/2.5.2/maven-install-plugin-2.5.2.pom
[INFO] Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-install-plugin/2.5.2/maven-install-plugin-2.5.2.pom (7 KB at 2.3 KB/sec)
[INFO] Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-plugins/25/maven-plugins-25.pom
[INFO] Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-plugins/25/maven-plugins-25.pom (10 KB at 10.2 KB/sec)
[INFO]
[INFO] --- maven-resources-plugin:3.0.1:resources (default-resources) @ SpringBootApp ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.7.0:compile (default-compile) @ SpringBootApp ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to D:\Saurabh Gupta\facingIssuesOnIT\SpringBootApp\target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.342 s
[INFO] Finished at: 2018-05-28T15:59:31+05:30
[INFO] Final Memory: 20M/209M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile (default-compile) on project SpringBootApp: Compilation failure
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

Solutions

To resolve this issue you can follow below steps by solving command prompt or Eclipse.

Command Prompt

How to Configure Maven in Window and Linux?

Eclipse

  • Right click on project -> Select Properties
  • Select Java Build Path-> Libraries Tab -> Click on Add Library
  • Refer below link for reference.

Eclipse : How to set java path of JDK/JRE?

Eclipse : How to set java path of JDK/JRE?


To set path of JDK for your project in eclipse follow below steps:

  • Right click on your project -> select properties.
  • Click in Library tab
  • To remove or update JRE/JDK remove existing from list as below.

See Also: Setup Java/JDK and Eclipse On Window & Linux

Eclipse ClassPath Setting 1
Eclipse : How to set JDK/JRE Path

 

  • Click on add Library and select option as “JRE System Library” and click on Next button.

 

Eclipse ClassPath Setting 2
Eclipse : How to set JDK/JRE Path

 

  • If you need to use existing JRE/JDK you can select from installed JRE or if need to add new one click on Add button.
  • You will get popup of JRE definition. click on Directory option and select JAVA (JRE/JDK) version home directory as in below screen shot
  • Click on Finish button.

 

Eclipse ClassPath Setting 3
Eclipse : How to set JDK/JRE Path

 

  • Select one Installed JRE which want to use on your project.
  • Click on “Apply and Close” button.

 

Eclipse ClassPath Setting 4
Eclipse : How to set JDK/JRE Path

 

  • Finally selected JRE/JDK added to your project.
  • Click on “Apply and Close” button.

 

Eclipse ClassPath Setting 5
Eclipse : How to set JDK/JRE Path