In this section, we are going to discuss about how to install java in your system and how to set path.
You can also refer our video tutorial for same.
So let’s start with this tutorial :
Installation of java and set path in java
Before installing the java, you must first check whether java is already installed your system or not. For this , follow the following the steps:
1. open cmd.
2. Write the below command in cmd.
3. If java is already installed on your system then after writing this command you will see this:-
4. If you don’t have installed java on your system then download it. For downloading the java open your web browser and paste this link: – https://www.oracle.com/technetwork/java/javase/downloads/index.html.
5. When you paste this link on web browser and enter you will see this screen:-
6. Click the first JDK download button and you will see this screen:-
7. Now accept the License agreement and click on the following link (if your system is window 64 bit ) otherwise choose the link according to your system configuration.
8. Now after downloading the java install it. Once you installed java on your system , now you need to set the path of java bin folder.
Why we set the path in java?
To execute java console based programs in windows environment we have to use java and javac commands. Since, java and javac commands are unknown for windows till we do not specify the path of javac compiler.
This is the reason while setting the path we specify path of bin folder (bin contains all the binary executable).
Moreover, if we place our java program in java’s bin folder and execute from same location. It is not even required to set the path. In that case O.S automatically identifies respective binary executables.
How to set the path in java?
There are two way to set the path in java:-
1. How to set the path temporarily in java? :-
To set the path temporarily , you need to follow the following steps:-
- open cmd.
- Copy the path of bin folder of jdk.
- Write the following command in cmd:-
set path=copied-path of bin folder
2. How to set path permanent in java?
To set the path permanently in java , you need to follow the following steps:-‘’
1. Copy the path of bin folder. For this go to c drive->program files->java->jdk->bin.
2. Go to my computer and right click on and click on properties.
3. Click on advance system setting.
4. Click on environmental variable.
5. Click on new button of user variable.
6. Now write the path in variable name and paste the path of bin folder in variable value.
7. Now click on ok.
8. Now again click on ok button.
9. Now the path is permentatly set. To check it open the cmd and wtite the following command:- javac
If your path is successfully set, then you will see the following line:-
How to set path in Linux:-
To set the path permentetly in Linux os, write the following command.
If you found this post useful, don’t forget to share this with your friends, and if you have any query feel free to comment it in the comment section.
Thank you 🙂 Keep Learning !