Watch the Video to Run a Java Program
Compiling and running a java program is very easy after JDK installation. Following are the steps:
After Type this code on the Notepad. Save as classname.java (Here Class name is Hello so Save as hello.java). inside the Java/jdk/bin (bin folder of Java , its create inside the C drive and Java folder).
Now your file save in the bin folder. Open Command Prompt... Go to the Start button on your Computer.
Like this...in windows 7/10

Click on it. and Type cmd on the Search Box....like this..
Now, Command prompt is open ....
Now use Change Directory Command (cd..) to Change the Directory..C:\Users\CSE> to C:\
Now Copy the Address of bin folder shown in the image.. and copy this address..
Now, Paste This Address..C:\Java\jdk1.5.0\bin on the command prompt (this address could be different as the location of the java path) Shown in the image below.
Click Enter After this...
Now, Firstly Compile the Java File that Save in the bin folder.
use command ..... javac classname.java (javac hello.java)
After type this command , Click on the Enter ..(if there is no error in the program, no error shown on the command prompt, Shown in the below image...
otherwise Shows the error list of error Shown in the Image above...).
Now, Once Program is Compiled Sucessfully then Run this Program using Command..
Java classname ... (java hello) as Shown in the Below.
Now, Program is run...and output is ...Hello...