Steps for Writing, Compile and Run Java programs

(Dos based without IDE)

 

Step 1: first install java software if already installed Java Software then ignore second step.

Step 2: for downloading Java software click below link

Step3: verify Java software availability in Computer or Laptop.

Check programs files folder, check inside it ‘Java’  folder exist , if yes

Check java folder which conations actually software who starts with jdk1.x.y.z

Step 4: for creating , compiling and executing java programs we create a directory or folder on D/ E drives.(this is not mandatory)   example working folder is “JavaPrograms”

Step 5: open Command prompt in one session and go to Java programs folder using cd command.

Step 6: another session open Notepad where we write new java source code , save source code using extension .java  example:  class name ‘simple’ save by simple.java in JavaPrograms folder

Step 7: now compile java code go to dos prompt give command

D:\JavaPrograms>javac simple.java

Step 8: now if source code have errors then all errors available in command window.

Otherwise message display javac is not internal or external ….. , if this error comes then set Java software path i.e  write dos prompt

D:\JavaPrograms>path=” C:\Program Files\Java\jdk1.8.0_131\bin”

Then follow again step no 7 i.e. compile command

If cursor goes next line without displaying errors , consider this code complied successfully. The class file ready for execution or run. ( simple.class is automatically generated)

Step 9: execute or run program use java command java ‘classname’

Example  D:\JavaPrograms>java simple

We get output on console (dos window)

Step 10: for updating and creating use Notepad and To   compile and run program use dos command.