For any person who had to study java has to install JDK. After installing JDK, path has to be set to execute java.
Before we get to know about the steps involved in setting a java path we must know its necessity
Whenever we write a java program we save it with an extension ‘.java’ and save it in any directory. To compile it we go to command prompt and enter our directory where the file has been saved. Then we use the command ‘javac filename.java’ to compile a java file. If the path is not set it gives the message as “javac is not recognize as an internal or external command, operable program or batch file” so it is necessary to set a path for java in order to compile a java program. We can set path in two ways
1) Temporary way 2) Permanent way
Temporary Way
1) Go to run.
2) Enter ‘cmd’ to enter command prompt.
3) Type setpath=<path where java has been installed>
*you can copy and paste your path here and that’s it the path is set temporarily.
But the drawback of this method is you need to type this every time you enter the command prompt
so to avoid this you can also set path permanently.
Permanent Way
1) Right click on my computer.
2) Select properties.
3) Go to advance tab.
4)Now click on environment variables.
5) And from ‘system variables’ select “path”.
6) Click edit button.
7) Now copy the path where java has been installed and paste it in path variables.
8) Click OK to save.
Here the path could be C:\Program Files\Java\jdk1.6.0_25\bin
Following these simple steps we can set path in java.
Still there are any doubts or problems please let us know through comments.