HOW TO WRITE AND RUN FIRST PROGRAM IN JAVA USING NOTEPAD?December 28, 2016 2016-12-28 9:47
HOW TO WRITE AND RUN FIRST PROGRAM IN JAVA USING NOTEPAD?
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)
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.
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.
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:-
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:-
when you click on enter key you will get following output