Here is simple java basic:
Create HelloWorld.java with code
public class HelloWorld {
/**
* @param args
*/
public static void main(String[] args) {
System.out.println("Hello world");
}
}
C:\>set Path=C:\Program Files\Java\jdk1.7.0_45\bin
C:\>javac HelloWorld.java
C:\>java HelloWorld
Hello world
or you can set system variable so no need to set Path=C:\Program Files\Java\jdk1.7.0_45\bin
Path=.........;C:\Program Files\Java\jdk1.7.0_45\bin
Refference: http://www.instructables.com/id/Programing-with-Java-using-Command-Prompt/