You are welcome...
Two things i can think of not using the -cp option is
1. If your .class file is in the same directory then you don't have to specify the class path option
2. If your .class file is present in the subfolders say C:/MyClasses/com/mypackage/HelloWorld.class and com and mypackage are the packages in which the HelloWorld is present. Now say if you are in the location C:/MyClasses in the cmd prompt you can just give java com.mypackage.HelloWorld
I hope you knew about packages - the declaration you give at the start of a java program if needed - say in this case ->
You do not need to specify every time the path of the java.exe. To make the OS to locate the java exe it you have to specify the JAVA_HOME and path variables in the Environment variables.
This post should help you setting the environment variables -
https://coderanch.com/t/551943/java/java/Wrong-version-appearing-java-command
and this to understand path & classpath ->
http://download.oracle.com/javase/tutorial/essential/environment/paths.html
Also I think Java should be already installed in your OS by default. So just type the command java in your command prompt and see what the output is shown.