hii everyone I just want to ask that why do we need to set the PATH
Because there are many applications in computer. every application has its own path. so we have to set our own path for java too. it's because you will be running in console i.e command prompt. so perfect path is should be set for perfect execution, and if path is not proper then application won't run..
A path is the location(s) on the file system or hard drive that will be checked to find the program you are trying to run. You probably have programs like Skype, Java or Microsoft Word on your computer that are installed in the Program Files folder on the hard drive. When you open a Run dialog or CMD window and type in java.exe, you are only typing in the name of the program - you haven't told the computer where on your hard drive that program is! Whenever you do that, the computer uses all the locations specified in the PATH statement in order to try and find the program you requested. In this example, the PATH statement would have the location of the Java runtime in c:\Program Files\Java\jdk1.8.0_25\bin as one of the locations to be searched and would find the program java.exe in that location. Just remember that if you have multiple locations to search in your path statement that you separate them with a semicolon.
set the path just do it its complicated to explain