WRITEING AND RUNNING FIRST PROGRAM IN JAVA USING NOTEPAD
First of all download JDK and install it for run java program. You can download JDK from here http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
After install JDK open Notepad and write your first program as given in following image.
public class Hello
{
public static void main(String arg[])
{
System.out.println(“Hello World”);
}
}
Now click on file menu and click on save as.
Remember program save with same name as of your class name given in program and give extension .java. When you will save your program byte code will generate.
Hello.java
Now open command Prompt and write command :- cd\
click on Enter . Now copy address of folder where you save your program.
and paste it in command prompt as given following.
cd\Users\Gurjant Bhullar\Documents
and then press enter key.
Now set path of JDK to compile and run program. To set path of JDK open C:\ drive in your system.
Then open program file folder in c drive. Open java folder under program folder. select jdk folder. In jdk folder open bin folder as given in following image and copy path.
Now paste path in command prompt as given in following image:-
set path = C:\Program Files\Java\jdk1.8.0_51\bin
Now write following command to compile your program:-
javac Hello.java
when you will compile your byte code a class file is generated which we can run later. You can see that class in same folder where you was same your byte code
After complete compilation now you can run your program using following command:-
java Hello
when you click on enter key you will get following output
Finished.