There are mainly three steps involved in developing java programs. They are
  1. Composing and Saving the java program.
  2. Compiling and creating *.class file.
  3. Running the *.class file such that it prints the output.
For writing and running a java program we must contain two softwares they are
  1. Editor: To write the Source Code. (Notepad, Notepad++)
  2. Command Prompt: To Compile and Run the Program.
Here notepad and command prompt (i.e. cmd) will come by default with the Operating System no need to install externally. In order to use external Editors like Editplus, Eclipse, RAD, RSA we need to install software separately.

  1. Compose and Save: Open notepad:
    First way: winwod+R type "notepad" Ok. Then type the program inside notepad.
    Second way: Go to start type "notepad" inside search press Enter
    public class HelloWorld {
                                        public static void main(String []args)
  2. Save above program under D:\JDK6.0\bin folder (i.e where java cmds are avilable)
    Folder Structure
    Folder Structure
    • we can place N number of classes inside a java file.
    • save the program with the class name that contains main method inside a java file. Because running of the program will be started from main method.
    • Save the programs with the extension <.java>
  3. How Compiling and creating *.class file. Open command prompt-> win+R-> type "cmd"->Ok. Then compile the program.
    1. First we have to go to the location where our source code is available (i.e., D:\JDK6.0\bin)
    2. For compiling we use javac command. Like below
    Folder Structure
    Javac Command For Compile

    if the program is successfully compiled '.class' file will be created inside 'bin' folder.
    Folder Structure
    After Compilation Folder Structure
  4. Running the *.class file such that it prints the output. For running the java program we use the command 'java' and it followed by '.class' file name. Likebelow
    Folder Structure
    Java Command For Run
  • Here we no need to give extension for java command (i.e. . "java HelloWorld.class") because compiler by default will be placed with the extension '.class' so no need to give extension for running purpose.If given so, it gives an error.
  • Once the .class file is created ,we can run the program directly as many times without compiling untill and unless the program is modified.
  • If any changes are made to the program,then we must and should compile the program, such that the modifications will be reflected into the .class file.

  • Here we are merging our program files with java commands or java software both in the same location which is n't advisable to do so.why because may be in future sometimes we may delete the java cmds instead of deleting our program files which leads to s/w corrupt and again if we want to get that cmd, we need to reinstall the java software.