My name is Subhash.K.U. I work as Principal Mentor at Subhash Programming Classes helping fresh engineering graduates and professionals crack their programming interviews through C, C++, Data Structures, Java and Linux Programming.
In this blog, I have given the very basic steps that one should follow to get his first Java program running. It is only a matter of minutes. Once you start, there won’t be anyone to stop you
Note: I would suggest you to open a new tab in your browser and then follow the below steps one by one.
Step – 1:
Download and install the JDK from the below link. Choose an option based on which system you intend to work.
Step – 2:
Set up the path. Take the path from (a) and Copy it to (b):
(a) My Computer -> C:Drive -> Program File(x86) -> Java -> jdk1.x.x -> bin
(b) Right Click My Computer -> Properties -> Advanced System Settings -> Advanced -> Environment Variables -> System Variables -> Path
Step – 3:
a. Create a folder in the D: directory named AllMyJavaPrograms ( You can create folder with any name of your choice)
b. Open Notepad by following the simple steps:
i. Search for notepad in the search icon, click on NotePad.
iii. Save the file as MyFirstProgram.java inside D:\AllMyJavaPrograms. Let the Save as type be Text Documents (*.txt)
c. Open command line window by typing cmd on the command prompt.
i. Type d:
ii. Type cd AllMyJavaPrograms
iii. Type dir ( You will see your first program file in it )
iv. Type javac MyFirstProgram.java (Compiling the java source)
v. Type dir (Now you will see your first byte code file along with the source file with extension .class – if the source file compiled successfully without any errors.)
vi. Type java MyFirstProgram (Your program is run)
You are now ready. Go ahead and start working on more Java Programs ! Welcome to the world of Application Programming through Java Programming Language. All the best !
About the Author:
Subhash.K.U, Principal Mentor,
Subhash Programming Classes, Bangalore