Hi guys!!! I’m going to show you how to set environment variables for java installation.
Here you will learn how to download and install Java JDK on your windows 10 operating system. So let’s get started.
Steps: How To Set Environment Variables For Java Installation
First open your browser(google chrome is preferred) and search for java jdk and in google search results click on the first link.
As you can see the above image first link that appears will be from oracle.com.
Just click that link and here you will see two options one is java platform with jdk another is netbeans with jdk 8. We want to click this java button,
Next you will see various options to download java on your windows operating system or linux or mac OS.
So first of all click accept license agreement radio button and then you can download these executable file for your operating system.
We want to install it for our windows operating system and if you are using windows 10 most probably you have 64-bit,
Also Read – Two Best Ways In Java To Sort String Array
Just click on last option Windows x64. After clicking it’s going to install java jdk on your windows 10 operating system.
Now once it’s downloaded (here i have downloaded it already) it’s going to look like this
It will be like an executable file which you can run. So, double click on it and it’s going to show a user account control,
Just click yes. Now the java setup has been started,
You just need to click next, in the next screen,
Leave everything default. Click next,
Next, you will see a dialog box asking for destination folder
Click next. If you want to change your destination to any other folder you are free to do so.
After clicking next you will see java installing,
Also Read – Java Example To Print All Alphabets
And when java installation is complete it will give you this message,
In this step click close button. Now what you need to do is open your folder explorer and go to your “This PC” and go to C drive and go to Program Files and here you will be able to see this folder called java.
And in this java folder you will see two folders one is JDK another is JRE,
So for simplicity you can rename two folders as only JDK and JRE.
Once you have installed java you just need to set up environment variable for java so that whenever some program wants to look for java it’s automatically recognized by your program.
To set up environment variable what you need to do is right click on your windows button you will see control panel option. Just open it and go to systems and security,
And in system and security click system,
And in here you just need to click advanced system settings,
And in here you will be able to see this environment variables,
And in here go to system variables tab, and scroll down and click path option,
Now double click on path option,
On variable value, go at the last and what you need to do is you need to copy the location where you have installed this java.
Go to Program Files >> Java >> jdk >> bin >> and copy this location which is C:\Program Files\Java\jdk\bin and then give a semicolon at the last.
And then paste your path which you have copied which is C:\Program Files\Java\jdk\bin and once again add a semicolon and go to the folder where you have installed java once again.
Here this time go to JRE folder and inside JRE go to bin folder. Once again copy this path which is C:\Program Files\Java\jre\bin and after the semicolon just paste this path. Now click OK button which will save your path.
Now to check whether java is installed properly on your system just go to your windows start button and right click and open command prompt.
In command prompt you just need to write “javac” and press enter and it gives you below result,
As seen in the above image there are so many options after typing javac and pressing enter.
Javac is basically a command to compile java source files. Now java JDK is installed on your system.