How to Install Java JDK 15 on Windows 10 ( with JAVA_HOME ) in 2021 and Run Basic Java Program Full Tutorial For Beginners

How to Install Java JDK 15 on Windows 10 ( with JAVA_HOME ) in 2021 and Run Basic Java Program Full Tutorial For Beginners
  • Post author:
  • Post category:Java
  • Post comments:0 Comments

 

 

Welcome folks today in this post we will be installing java jdk 15 version on Windows 10 in 2021. This will be a full tutorial on how to run a basic java program on windows 10. All the steps will be given below.

 

 

Get Started

 

In order to check if java is already installed on your computer. You can check on cmd by executing the following command

 

java -version

 

 

 

As you can see java is not installed on our machine.

 

In order to get started we need to go to Official Oracle Website to Download the Latest Java JDK 15 on your computer.

 

 

 

 

 

 

 

 

 

And now this will download the exe file inside your computer after it finishes it will look something like this

 

 

 

 

Now we need to open this exe file and install java inside our computer

 

 

 

 

And now click next two times and then it will complete the installation process and at last you will see this screen which says java is successfully installed on computer.

 

 

 

 

And now you can find the path on which java is installed

 

Go to My Computer and then to Program Files and then you will find a Java folder like this

 

 

 

And then inside the java folder you will find the jdk folder like this

See also  Java Swing AWT Program to Build Currency Converter Using JSON API GUI Desktop App Full Project For Beginners

 

 

 

Setting Path Variables

 

 

Now we need to set path variables in order to completely access java globally inside the system

So for that go to  system advanced settings like this

 

 

 

 

 

And after clicking environment variables we need to edit the system path variable like this

 

 

 

So here we need to create a new entry inside the system path variable and paste this path here for your jdk

 

C:\Program Files\Java\jdk-15.0.1\bin

 

So now save this and close the window

Now we need to create a new global variable which is called as JAVA_HOME so just click the new button like this

 

 

 

 

 

So we are writing the following details

 

Variable Name: JAVA_HOME

Variable Value: C:\Program Files\Java\jdk-15.0.1

 

Now just click OK button two more times to save it

 

 

 

 

 

So now congratulations Java is installed on our system so you can again check by going to cmd and executing the following command to check version of java installed on the machine.

 

java -version

 

 

So you can see I have Java 15 installed on my computer.

 

 

Running Sample Java Program

 

 

Now we will make a sample java program on editor and running it  on computer

 

So now create a sample.java file and copy paste the following code to it

See also  Java Program to Resize Multiple Images and Thumbnail Generator Full Project For Beginners

 

 

 

 

sample.java

 

 

// Your First Program

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

 

 

So it’s a simple hello world program which prints hello world on the screen.

First of all go to command prompt and execute this command to compile the .java file to .class file like this

 

javac sample.java

 

 

 

So once the command completes it will create the HelloWorld.class file like this

 

 

 

So now run this .class file by going to cmd and execute the following command

 

java HelloWorld

 

 

 

So you can see the program prints out hello world on the screen

 

Leave a Reply