Introduction
Java is relatively easy to learn and use. We will be learning step-by-step how to run Java program.

Java is an object-oriented language. It enables automatic memory management. It also has multi-threading. It has a vast standard library. It is open-source so you can use it for free. You can use it to make various web and mobile applications.
You write a Java program in the Java programming language. You can run a Java program on a Java Virtual Machine (JVM). JVM converts Java bytecode to machine code. Your Java programs are portable.
Now you will learn how to run Java programs in the command prompt.
Start with installing the Java Development Kit (JDK). Remember to set the JDK path in the system environment variables.
Steps to Run a Java Program
Here are the steps on how to run Java program:
Step 1 - You need to have JDK to run a Java program. So you can download the JDK from the Oracle's official site.

Step 2 - First, you need a text editor. We are using Notepad here.

Step 3 - Click on the "Start" button. Then type "Notepad" in your search bar. Now click on the Notepad app and open it.
Step 4 - Write your Java program. Now save it with a .java extension. Here it is HelloWorld.java.

Step 5 - Now open your terminal. Click on the "Start" button. Type "Terminal" in the search bar. Click on the Terminal app and open it.
Step 6 - Go through to the directory having your Java program. Use the cd command.

Step 7 - Now, use the Javac command to compile your Java program. Here it is javac HelloWorld.java.
Once you are done compiling, it's time to run your Java program. Use the Java command to run it. Here it is java HelloWorld.

We successfully ran our Java code. Similarly, you can run any code you want.
There are many online Java compilers where you can run Java programs. You can also run your Java programs in an integrated development environment (IDE) such as Eclipse, IntelliJ IDEA, NetBeans etc.
As you have now understood how to run Java program, let’s get to know about various types of Java programs.