I hope you have set java environment variable in system else follow this link >>
Environment Set
open up command prompt, move to directory which contain .java file using cd in windows.
you need to compile first so, write following instruction to compile
javac filename.java
after successful completion of compilation run program, use instruction written below to run program.
java filename
for more information follow these links below
Environment set UP
Environment set up
Compiling and running file
Compile and run
Hope it will help you. if there is any problem let me know