Welcome to Java Programming world. Let’s learn how to write our first Java program. We’ll first talk about the requirement you need to set up for your development work.

1. IDE / Code Editor

IDE stands for Integrated development environment. It helps you speed up your development work. It also helps with the syntax using intellisense. Code editor is an advanced Text editor that is light weight, does not bring anything extra than you require to start your programming. It helps you reduce the complex part of understanding IDE at initial stage and you get to know more about how code compile and runs. Personally, I feel code editors are better to start the programming than switching to IDE on first day.

2. Java Development Kit And Runtime Enviornment

In order to develop Java Programs, we need Java Development Kit and to run and see the output we need the Java Runtime Environment . We can download it from here selecting the version based on your host operating system. I will add a post with steps to install the JDK.

3. Create program and save with extension .java

Let’s write our first Java program.


  • Open Visual Studio Code
  • Select New File from File menu.
  • Save the new file with name GreetingApplication.java and ensure to save it in a folder path you can remember and next time can open it.
  • Create a new class
  • Add main method to the class GreetingApplication
  • Save the file and we will compile and run the program

4. Compile java file

  • Open terminal on ubuntu / cmd on windows and go to the folder where we have saved the java program.
  • Compile your file using the command

5. Run the program using java command