I have a very basic question to ask, that why do we need to add a semicolon at the end of PATH variable and why don't we add semicolon in JAVA_HOME variable?
I read lot of books and forums:
To separate different paths in PATH variable? or to tell the system or JRE not to look any further after that.
JAVA_HOME variable is to help the JRE to look for more files and extensions like JDBC drivers etc. in future development.
PATH is an operating system-specific idea. It just means, "when I type a command, check these paths as well". The current directory you are in is usually on the searched paths by default. If you think about it for a minute, you can easily imagine how much of a pain it would be to use a command line if you didn't have the idea of PATH.
So, given a PATH (with multiple directories), you need a way to separate the entries. Each operating system can use whatever character, but the two most popular are semi-colon (on Windows) and colon (on most systems Unix, e.g. Mac OS X).
JAVA_HOME just points to wherever your preferred Java installation is located. One value, so no need for a character to separate entries.
As an aside, you'll also run into CLASSPATH, which is the paths of all of the libraries (JARs) and resources (e.g. property files) your Java app is loading. CLASSPATH uses the same format/characters as PATH.
As an exercise, try writing a little bit of code that loops over and prints out the values of System.getProperties() and System.getenv(). It's a great way to see all of the little configuration elements.