- Install and Configure the Java Development Kit (JDK) on macOS, Linux, and Windows
- Java at a Glance: Key Differences Between JRE, JDK, and JVM
- Introduction to JShell in Java
- Creating Your First Java Application With IntelliJ IDEA
- Debugging Java Applications: A Guide with IntelliJ IDEA
- Java Essentials: A Beginner’s Guide in 7 Key Points
1. Introduction
In the previous article, we saw how to create, compile, and run a Java application using a Terminal. However, in a real-world example, we cannot use a simple text editor as we did in that tutorial. Building a large Java application requires a tool that can speed up the process by automating respective tasks like code compilation. Integrated Development Environment tools like IntelliJ are designed to address these problems. In this tutorial, you will create and run your first Java application using IntelliJ IDEA.
2. Prerequisites
You must have IntelliJ IDEA installed in your workstation to complete this tutorial. Follow this tutorial if you don’t have IntelliJ.
3. Create the Project
Launch IntelliJ, and from the burger menu, click New -> Project…
Fill in the project information as shown below:
Project name: helloworld-intellij
Location: <Choose where you want to store the project files>
Language: Java
Build System: IntelliJ
Add sample code: <Check the box>

Click Create. The project will be created and automatically loaded.

4. Complete the main method
After the previous step, IntelliJ will automatically create the project folder and a default class Main
with a main
method.
Complete the main method as shown here:
public static void main(String[] args){
System.out.println("Hello World!");
}

To execute the project, click any of the highlighted buttons below:

You will then see the following output in the console:

No more “javac” to compile the code before running it. IntelliJ automatically handles it for you.
We have just scratched the surface of what you can achieve with a modern IDE like IntelliJ.
If you enjoyed this post, consider visiting these other guides: Introduction to JShell in Java, Create, Compile, and Run Your Hello World Java Application using a Terminal
5. Conclusion
In this quick tutorial, you learned how to create and run your first Java application using the modern IDE IntelliJ. We have just scratched the surface of what you can achieve with a modern IDE. Learn more about IntelliJ IDEA in the official documentation.
Pingback: Java Hello World Program