To run java you must install JDK. If you dont have it download it from :
Setting Enviroment Variables:
Right Click Computer
Click Advanced System Settings under properties
Click New under Enviroment Variables
Set “path” as Variable name
For Variable value you need to go to the folder where you installed JDK
Inside JDK installation directory open subdirectory bin
Right Click any file inside that directory Under properties
Copy the address of the file that address is Actually the Variable value of variable path press “ok”
Open Command Prompt and type “javac” alot of crap will show up. This is the indication that you’re ready to go!
In Command Prompt change your current directory to the directory in which u saved the file which u want to run
type “java FileName” ‘java ‘ is the command to execute the java code “FileName” is the name of .class file.