Modern Java IDEs make development faster and more convenient, which is why most developers rely on them daily. However, there are still real advantages to knowing how to compile and run a Java program without using an Integrated Development Environment (IDE).
Running Java programs manually helps you understand how Java works behind the scenes and is especially useful for beginners, troubleshooting, interviews, or working on systems where an IDE isn’t available.
In this guide, we’ll show you how to run a Java program without an IDE on Windows, using the Command Prompt.
Prerequisites
Before proceeding, make sure the Java JDK is installed and properly configured on your Windows 11 computer. If you haven’t installed it yet, follow the linked JDK installation guide first. Once Java is set up, you can continue with the steps below.
How to Write Java Code Without an IDE
To write Java code, you don’t need an IDE. You can use any basic source code editor such as Notepad++, Sublime Text, or even Notepad.
For this tutorial, we’ll create a simple Java program that prints:
Welcome to thecoderworld YouTube Channel!
We’ll use Notepad++ to create the Java file.
Sample Java Code
public class HelloYouTube {
public static void main(String[] args) {
System.out.println("Welcome to thecoderworld YouTube Channel!");
}
}
Important Notes:
- The class name and file name must be the same.
- Since the class name is
HelloYouTube, the file must be saved as:HelloYouTube.java - Save the file in an easy-to-find location. In this guide, we’ll save it on the Desktop.
Once your Java file is ready, you can move on to compiling and running it.
How to Run a Java Program Using Command Prompt
To run a Java program from the Command Prompt, you should have a basic understanding of Command Prompt commands, as we’ll use it to navigate folders and execute Java commands.
First, confirm that Java and the Java compiler are properly installed. For that, open Command Prompt and run the following command one by one:
java -version
javac
java -version confirms Java is installed and javac is the Java compiler used to compile .java files. If both commands work without errors, you’re good to proceed.
1. Since the Java file is saved on the Desktop, change the directory using: cd Desktop. This tells Command Prompt where your Java file is located.
cd Desktop

2. To view all files in the current directory, run the following command. You should see HelloYouTube.java listed in the output.
dir

3. Now, compile the Java file using:
javac HelloYouTube.java

4. If the compilation is successful, this command will generate a new file: HelloYouTube.class. This .class file contains the compiled bytecode.
5. To execute the compiled Java program, run:
java HelloYouTube.java
Note
Alternatively, you can simply run this command: java JelloYouTube.

6. You should now see the output printed in the Command Prompt:
Welcome to thecoderworld YouTube Channel!
Conclusion
You can easily write, compile, and run Java programs using only a text editor and the Command Prompt. This approach is perfect for learning Java fundamentals, understanding how compilation works, and running simple programs without relying on an IDE.
For larger and more complex projects, however, using a full-featured Java IDE such as Eclipse or IntelliJ IDEA is highly recommended, as they provide advanced tools like debugging, code completion, and project management.

