In this tutorial I will show you how to set JAVA Path in PATH variable as environment variable in Windows 10 operating system.
WHY YOU NEED TO PATH SET JAVA?
With out java path set you can not use java for coding. if run any code with out installing java you may get error: "JAVAC IS NOT RECONGIZED AS INTERNAL AND EXTERNAL COMMAND."
The path set in environment variables is required to be set for using java commands like javac, java, etc. used for compiling and run java program.
If the Java source file you created will be saved inside the JDK/bin directory, the path is not required. All the tools will be available in the current directory so directly recognize.
However, if you want save your Java file outside the JDK/bin folder, it is necessary to set the path of JDK.
You can path set java in two ways:
- Temporary
- Permanent
How to set the JAVA PATH in Temporary way on windows?
To set the temporary path of JAVA or JAVA JDK, you need to follow the following steps:- Open the command prompt
- Copy the path of the JDK/bin directory. You can find the JDK in the C:\Program Files\Java\jdk1.8.0_291\bin
- Write in command prompt: set path=copied_path
set path=C:\Program Files\Java\jdk1.8.0_291\bin
if you are java programmer then this is way is the best
How to set Permanent Path of JAVA in Windows?
For setting the permanent path of JAVA/JDK, you need to follow these steps:
- Find MyComputer then right click in blank spece.
- Go to properties -> advanced tab -> environment variables -> new tab of user variable -> write path in variable name -> write path of bin folder in variable value -> ok -> ok -> ok
- GO TO THIS PC AND RIGHT CLINK ON IT or ENTER INSIDE THIS PC AND RIGHT CLICK IN A BLANK SPACE
- GO TO ADVANCE SYSTEM SETTING
- IF YOU CANNOT FIND PATH VARIABEL CLICK ON NEW
- SET NAME JAVA_HOME AND PASTE THE PATH OF JAVA/JDK/BIN find in the C:/ drive
- THEN CLICK OK>OK>OK>
Setting Java Path in Linux OS
Setting path in Linux OS is the same as setting the path in the Windows OS. But, here we use the export tool rather than set. Let's see how to set path in Linux OS:
export PATH=$PATH:/home/jdk1.6.01/bin/
Here, we have installed the JAVA in C:/ DRIVE AND SET PATH IN PATH SYSTEM VARIABEL: