What is Java Development Kit (JDK) in Java?

September 5, 2024
Java Development Kit ( JDK )

When building Java-based software applications, JDK can help to fast-track the development process and simplify the project. Along with the JVM (Java Virtual Machine) and the JRE (Java Runtime Environment), JDK is among the core technologies used in Java programming.

A proper understanding of JDK can help you make vital decisions about the software building project. This blog explores JDK in detail.

What is JDK?

The term JDK stands for Java Development Kit and is basically a collection of software development tools and supporting libraries that proves handy in building Java-powered software solutions. It is used in combination with JVM and JRE.

In simple words, we can also say:

JDK(Java Development Kit) = JRE (Java Runtime Environment) + Development Tools
If you are new to Java programming, there can be significant confusion between JRE and JDK. The important point to note here is that Java developers can run programs on a machine with JRE only.

However, JDK is a must-have for building software applications.

What is the architecture of JDK?

java development kit (jdk)

JDK consists of JRE, which contains JVM, class libraries, and others. Let’s explore these in detail.

JVM (Java Virtual Machine)

Java Virtual Machine (JVM) basically provides a run-time environment for the Java source code to run. JVM is the reason why Java developers can leverage “Write once and run anywhere.” This means you can run Java programs anywhere. It stays on top of the host operating system and is responsible for translating the Java source code into ByteCode (machine language) and program execution.

JRE (Java Run-time Environment)

As the name suggests, the Java Run-time Environment is the platform for executing the Java applications source code. It integrates various plugins and jar files and also offers support for libraries for running the source Java code.

What are the components of JDK in Java?

The main components of Java development kit JDK are as follows:

  • java

It is responsible for loading the class files and interpreting the source code compiled initially by javac.

  • javac

It correctly specifies the java compiler for translating the source code into bytecode.

  • javadoc

The comments that are added in the source code are documented by the javadoc.

  • jar

It assists the archives with adequately managing the jar files in the library package.

  • jps

JPS stands for Java Virtual Machine Process Status Tool, which is responsible for managing the active JVMs for the ongoing execution of the Java programs or a Java command.

  • appletviewer

It can run and debug Java applets without requiring a connection with an internet browser. 

  • Idlj

This compiler is responsible for generating Java bindings from a given Java IDL file.

  • javap

It behaves as a file disassembler. 

  • JConsole

It simply behaves as a Java Management and Monitoring unit.

  • javah

It is both a stub-generator and a C-Header, which are helpful in writing native methods.

  • javaws

The javaws works as the Web Start launcher for JNLP applications.

  • jhat

It is a heap analysis tool.

  • jmc

The full form of JMC is Java Mission Control.

How to set up JDK in your development environment?

The process of setting up JDK is simple and straightforward. The following steps allow you to successfully set up JDK in your development environment:

Installation of JDK

  • Go to the Oracle’s official Download Page
  • Choose the latest JDK version
  • Click download 
  • Add it to your classpath
  • Check whether the JDK software is installed on the device

Set JAVA_HOME for Windows with the following actions:

  • Right-click on My Computer 
  • Choose Properties
  • Go to the Advanced tab 
  • Choose Environment Variables
  • Edit JAVA_HOME to point to the location where JDK software is stored

In some instances, you need to restart the system after the installation of JDK.

JDK - Java development Kit

How to compile and run Java code with JDK?

The JDK compiler can transform Java text files into executable programs. The text segment is translated into bytecode post-compilation. It also carries the .class extension.

The first step is to build a Java text file and save it with a name. Given below is an example.

class Hi{
    public static void main([]args){
        System.out.print("Hi Geek")
    }
}

Now, use the javac command, which helps with Java compilation. Provide the complete path of your Java text file to the command line. Write this path before the file name, keeping the path and javac.exe inside the quotes.

"C:\Program Files\Java\jdk-11.0.9\bin\javac.exe"Hi.java

 

To run the code, simply use the appropriate command; you do not need to use .class. For example,

C:\Users\Pinaki\Documnets>java Hi

(Output:) Hi Geek!

Wrapping Up

At JS Panther, we can help you with end-to-end software development using the Java programming language. Having worked for 30+ business industries, we can help you create high-quality software that fulfills the desired objective and also meets regulatory compliance.

Share On Facebook
Share On Twitter
Share On Linkedin