Tutorials Hut

Tutorials Hut

Java JDK : Definition, Download and Installation

JDK stands for java development kit. It is a package of executable files and jars. You can use it to compile any java code written in a file with extension “.java” and generates .class file (command used “javac”).  Once java file is compiled, you can use the generated .class file to execute/run using “java” command

JDK is required to write any java code on simple notepad or using any IDE (Integrated development environment) example: Eclipse or Intellij.

See below installed JDK details on MAC OS:

Java development KIT (JDK) and Java Runtime Environment (JRE) Installed
JDK and JRE Installed

JDK Versions and More Detail

Recent and the most popular version of JDK is Java 8 JDK, while downloading you may choose to download JDK SE (Standard addition) which does not include libraries for enterprise java or Java EE (java enterprise edition), for now you can choose to download JDK SE.

How to Check Installed Java Version

Use below command on console to check installed java version.

This will give installed version details, if already installed.

java -version

Where to Find Java JDK

You can download JDK package from official page of Oracle for java http://www.oracle.com/technetwork/java/javase/downloads/index.html, there are many versions available, for JDK 8 refer this download link https://www.oracle.com/in/java/technologies/javase/javase-jdk8-downloads.html

How to Install JDK

Once you have downloaded, simply run installer you will be asked to select these components: Development Tools, Source Code, and Public JRE. You may install one or all of them. In this case, just select the default option or install all.

A Sample Java Program

Follow below steps to write sample java program from scratch:

1) Open a notepad (on windows) or Subline text (on MAC) and write below code and save as Hello.java


public class Hello {
public static void main(String[] args) {
System.out.println("Hello from Java");

2) Open console at path where Hello.java is saved and run below command:

 javac Hello.java 

3) Now run below command, this will run generated byte code class Hello.class and show output on console.


 Java Hello 

Output on console:

Hello from Java

Wow! You have completed your first sample java program; next you can read our JRE and JVM related chapters which will make a base for your java study.

Most Popular Java Commands

Below is a list of common and the most popular java commands.

1) Javac: This command is used to compile any java code, we already saw one example of this while compiling our Hello.java program in above sections

Syntax: javac

Example: If I have a java code in my java file named “HelloWorld.java”, I can use above command from console to compile it and generate .class file (byte codes), open your console/command prompt/iTerm(MAC) and go to path where your file “HelloWorld.java” is saved and run below:

javac HelloWorld.java

2) Java: This command is used to run any compiled java code or .class file.

Syntax: java

Example: Open console, go to path where your .class file is available and run below for “HelloWorld.class”

java HelloWorld

3) Java: Use java command with “-version” argument to check installed JDK and JRE, this will give error if java is not installed.

Example: Open console and run below command.

java -version

  • Leave a Reply

    Your email address will not be published. Required fields are marked *

    Scroll to Top