Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding Ninjas X Naukri.com
Table of contents
1.
Introduction
2.
About JDK 
3.
Downloading and Installing JDK
4.
Components of JDK
5.
Working with JDK
6.
FAQs
7.
Key Takeaways
Last Updated: Mar 27, 2024

Java Development Kit(JDK)

Author Yashesvinee V
0 upvote
Master Power BI using Netflix Data
Speaker
Ashwin Goyal
Product @
18 Jun, 2024 @ 01:30 PM

Introduction

In today’s world, most applications are built using Java. This could be because Java provides an excellent cross-platform development environment along with a collection of libraries to work with. JDK(Java Development Kit) is one of the three core technology packages along with JRE(Java Runtime Environment) and JVM(Java Virtual Machine). It provides the tools and services required to develop software applications with ease.

Recommended Topic-  Iteration Statements in Java, Duck Number in Java

About JDK 

The JDK plays an essential role in the Java application development lifecycle. In short, it is a software package that contains the compiler and class libraries to create Java-based applications. The JDK consists of a JRE, a compiler, an interpreter, and an archiver. The JRE contains tools to run Java programs, so the JDK requires it.

The packages part of the JDK are kits targeted to work on different types of development. The Enterprise Edition (Java EE) contains tools for Enterprise application development and Object-relational mapping. It focuses on web-based applications with servlet specifications. Usually, all JDK versions include a Standard Edition(Java SE). The Micro Edition, Java ME is also an available JDK package.

Get the tech career you deserve, faster!
Connect with our expert counsellors to understand how to hack your way to success
User rating 4.7/5
1:1 doubt support
95% placement record
Akash Pal
Senior Software Engineer
326% Hike After Job Bootcamp
Himanshu Gusain
Programmer Analyst
32 LPA After Job Bootcamp
After Job
Bootcamp

Downloading and Installing JDK

The Java SE JDK can be downloaded from the official Oracle site. There are many types and versions of JDKs available. Choose the most suitable one for your use.

The JDK you install determines the Java version you will use to code. This means that to compile a Java 8 code, you may require at least a Java 8 JDK.

On running the JDK installer, you will be prompted to select the Development Tools, Source Code, and Public JRE. These are optional. Installing Development tools provides services for monitoring, troubleshooting, security, and deployment for Java applications. The Source code contains the public classes of the core Java API. Public JRE allows other programs to execute Java Programs.

You can verify installing JRE and JDK by running "java -version" on the command prompt after navigating to the default locations of your OS.

Also read, Swap Function in Java

Components of JDK

Some of the components of JDK are:

java Loads java apps
javac Java compiler
jar An archiver that manages class and library files
javadoc Uses source code comments to generate documentation automatically.
Applet viewer Debug and run Java applets without the help of a web browser
javafxpackager Sign JavaFX applications and import related packages
javah A ‘C’ header and stub generator that writes buit_in methods
javap Disassemble class files
JConsole For Java monitoring and management
jmap An Oracle Memory map that prints heap memory details of a process
jinfo Prints the configuration information of a Java process
jhat An experimental Java heap analysis tool
apt An annotation processing tool
extcheck Detects conflicts in a jar file
jmc Stands for Java Mission Control
jps A JVM Process and Status tool that lists the JVMs of a target system.
jstack It prints the stack traces of Java threads
jstat A statistical monitoring toll of the JVM
jrunscript A Java command-line shell script
javaws A web start launcher for JNLP applications
jabswitch For Java Access Bridge
xjc Generates Java classes after accepting XML schema
jdb A Java debugger
jarsigner JAR signing tool and verifier
keytool Manipulates the Keystore

 

Working with JDK

  1. Create a file using a text editor with .java as its extension. Open the file and type your java code in it.
     
  2. Use the JDK to convert this file into an executable file. This can be done by using the javac command in the command prompt. Now, the file’s extension would be .class. This compiled code is the Java bytecode.
     
  3. The above command will create the Program.class file in the same directory.
     
  4. Run the file using the java command 
     
"C:\Program Files\Java\jdk-10.0.1\bin\javac.exe"Program.java
C:\Users\Documents>java Program

The javac command is stored in the /bin directory that contains many other useful tools. One such tool is the jar tool. A jar file contains a set of Java classes generated by the compiler. Compressed and arranged in a specific way.

We can convert .class file to .jar by using the following command. 

"C:\Program Files\Java\jdk-10.0.1\bin\jar.exe" --create --file Program.jar Program.class

Add .jar to the classpath using the -cp option and run it. To execute the program inside it. 

java -cp Program.jar Program

Check out this article - Upcasting and Downcasting in Java and Hashcode Method in Java.

FAQs

Q: What is the difference between JDK, JRE, and JVM?

  • JDK is a Java Platform specification that helps developers create Java Applications by providing the necessary tools and libraries.
     
  • JRE is a Java component that runs Java programs. It is a part of the JDK.
     
  • JVM helps execute Java programs on any device or Operating system.
     

Q: What is the difference between Java SE, Java EE, and Java ME?

  • Java SE: used to develop standalone applications. We can execute software and deploy portable code for desktop and server applications.
     
  • Java EE: used to develop Enterprise scalable and multi-tiered applications with APIs like servlets, applets, WebSockets, etc.
     
  • Java ME: used for running Java programming language applications on small devices, like mobile phones, by providing small-scale virtual machines and libraries for small device application development.

Key Takeaways

To build scalable and reliable Java-based applications, a deep understanding of JDK is essential. This blog highlights the basics of JDK, its components, and its uses. It also explains how to install and work with JDK to compile and execute Java application programs.

Related Links:

Data Types in C++

Why is Java Platform Independent

Difference between JRE, JDK, and JVM

Addition of two numbers in java

Read more, how to run java program

Learn more about Java on the official Coding Ninjas Blogs site. 

Check out the Coding Ninjas Studio platform to prepare for coding interviews. 

Previous article
this Keyword in Java
Next article
Java And Operator
Live masterclass