How to download Java(install, setup) & write the first java program?

Hello guys,

In this article, I will help you guys to download, install, setup java environment, and we will write and execute our first java program 🙂

so let’s get started…

1)Check java is already installed on computer/laptop:

To check type javac in the command prompt, if it shows javac is not recognized as an internal or external command then java is not installed…

2)Download Java JDK for a suitable environment:

The below link will redirect you to the oracle website where you can download the Java JDK for Windows, Linux & mac for 32/64 bit operating system.
choose a suitable version based on your requirement.

Java Download

This will redirect you to oracle website and their you need to login to your account then it will start downloading automatically.(if you dont have oracle account then create one)

To install the downloaded software double click on it then it will show below pop up…select next

follow below steps:

3)Setup the Environment variable:

For the operating system to understand where java is installed we need to set up the java JDK path in the environment PATH Variable. follow the steps shown in the image to set the environment variable path and finally say ok to all.

Now check the javac command in command prompt…it should not show any error.

Java is installed successfully ….. let’s write our first java program and execute it.

Create a text file with the name ‘Simple.java’ & open it in a text editor and write the below code & save it.

Now open the command prompt in that folder where the ‘Simple.java’ file is created and write the below commands:

To compile java Program: javac Simple.java

To Run Java Program:
java Simple

If the above commands print “Hello World” on command prompt then your program is executed successfully.

If you follow all steps correctly then java will be installed correctly on your desktop/laptop.

If you face any issue/problem while following any of the above steps feel free to comment below…I will definitely try to solve your issue.

Thanks,

Leave a Reply