Skip to content

The JDK

Estimated time to read: 2 minutes

JDK

Developers wishing to write Java programmed need to install the 'Java Development Kit' for whichever release of Java they wish to use. They are delivered with a JRE.

JRE

Anyone who wants to run Java programmes, but not write them, can download the much smaller 'Java Runtime Environment' instead.

Installing a JDK

Adoptium

On macOS brew install openJDK

JDK Contents

  • ./bin holds the tools required to create Java applications
  • java - Executes Java dode
  • javac - Compiles Java source code
  • javadoc - Reads Java source code files and creates HTML base documentation from them
  • jar - Takes a collection of compiled Java classes and bundles them into a single 'jar' file.

./lib holds support files ./jre contains the runtime environment equal to the JDK version

Running Java applications

Hello World

A simple Java version of HelloWorld

Hello.java
public class Hello
{
    public static void main (String[] args)
    {
        System.out.println("Hello World!");
    }
}

Compile to a class

javac /path/to/Hello.java

Run

java /path/to/Hello.class

Java Ecosystem Popularity - Versions and Frameworks

The snyk company produces an annual JVM ecosystem report.

Their 2020 report identified a few items of interest:

  • 36% of developers had switched from Oracle JDK to OpenJDK due to Oracle's licensing changes.
  • 64% of developers are using Java 8. Only 25% use Java 11. Those are the current LTS (Long-Term Support) releases. Although, some took issue with the change in licensing, the primary reasons appear to be that Java 8 works just fine, and Java 11 not only offers nothing significant enough to inspire migration, but actually removed almost 2000 classes from the Standard Library.
  • 60% of developers use Spring.

Based on this, one should expect Java 8 LTS to be around for a very long time, which is well-confirmed by the support plans, which state that Java 8 will be supported for years after Java 11 LTS is long gone.

Compilation to Execution

Screenshot 2022-07-04 at 10.29.17.png

Java Source File > Compiler > Neutral Byte-Code > (JRE) Byte-code Verifier - Class Loader - JIT (/JRE) > Native Code > OS > Hardware