Java development for beginners

Installing IntelliJ IDEA: Setting Up a Java Development Environment

All videos of the tutorial Java development for beginners
Jan Brinkmann
By Jan Brinkmann Last updated on

Before you write the first line of Java code, you need a place to type it in, check it, and run it. A simple text editor is theoretically enough for that, but in the long run an integrated development environment, or IDE for short, is worth it. It shows you errors before you start the program, suggests variable names and methods, and helps you look up parameters. In this guide, you set up the environment with IntelliJ IDEA, create your first Java project, and run your first program.

Java for beginners - Install 2.3 IDE

The video is only loaded from YouTube when you play it – data (including your IP address) is then transmitted to YouTube/Google. More in the privacy policy

Key Takeaways

Key Takeaways

  • An IDE combines an editor, syntax highlighting, error hints, a debugger, and compilation logic in one program.
  • For getting started, the free Community Edition of IntelliJ IDEA is entirely sufficient.
  • The name of the file must exactly match the name of the public class, for example MyMain.java and public class MyMain.
  • The main method is the entry point of every Java program, which the runtime environment calls.
  • A successful test run with System.out.println confirms that the environment, compiler, and execution work together.

Step-by-Step Guide

Step 1: Understanding the Role of an IDE

Think of the IDE as a workbench where everything is within reach. You no longer have to switch back and forth between the editor, compiler, and terminal, but handle everything in one place. Especially as a beginner, you learn faster with an IDE because hints immediately show you where something is wrong, for example a missing semicolon.

Installing IntelliJ IDEA: Setting Up a Java Development Environment

Step 2: Choosing the Right Development Environment

In the course, you work with IntelliJ IDEA, a Java IDE from the vendor JetBrains. There are also alternatives such as Eclipse or NetBeans, which likewise offer many features. However, the course is geared toward IntelliJ IDEA, so the examples can be followed most directly there. If you run into problems with a different environment, you will have to find your own way in those cases.

Install IntelliJ IDEA: Set up a Java development environment

Step 3: Finding the Download on the JetBrains Website

Go to the site www.jetbrains.com. Via the menu item Products and the IDEs section, you get to the development environments. There you will find IntelliJ IDEA, which stands for "intelligent Java IDE". Then select the download for IntelliJ IDEA.

Installing IntelliJ IDEA: Setting Up a Java Development Environment
Install IntelliJ IDEA: Set Up a Java Development Environment
Installing IntelliJ IDEA: Setting Up a Java Development Environment

Step 4: Selecting the Right Operating System

On the download page, versions for Windows, macOS, and Linux are available. Choose the variant that matches your operating system. Linux is fully supported, and since IntelliJ itself is largely written in Java, you are working with a Java application, even if you hardly notice that in everyday use.

Step 5: Downloading the Community Edition

You will see two variants: Ultimate and Community. For this course, you need the Community Edition. It is free and covers everything you need for learning. The Ultimate Edition includes additional tools for Java Enterprise and frameworks such as Hibernate. You won't need these in the first few months. Switching later is possible at any time.

Step 6: Performing the Installation

After the download, you start the installation file with a double-click. On Windows, you follow the usual dialogs and confirm the steps. On macOS, after opening the installation window, you simply drag the program into the Applications folder. After that, IntelliJ IDEA can be started normally via the program menu.

Installing IntelliJ IDEA: Setting Up a Java Development Environment
Install IntelliJ IDEA: Set up a Java development environment

Step 7: Starting IntelliJ IDEA for the First Time

When you start it for the first time, the welcome screen appears with a note about the Community Edition. In addition, the "Tips of the Day" window often opens. These tips are worthwhile because you gradually get to know keyboard shortcuts and useful tricks there. If they bother you, simply uncheck the box. Afterwards, the IDE asks you whether anonymous usage data may be sent. The decision is up to you.

Install IntelliJ IDEA: Set Up a Java Development Environment
Installing IntelliJ IDEA: Setting Up a Java Development Environment
Installing IntelliJ IDEA: Setting Up a Java Development Environment

Step 8: Create a new Java project

Click on "New Project" and select a regular Java project. You don't need a template at this point. Give the project a name, for example "My first project", and confirm with Finish. The IDE then creates folders, including a hidden folder .idea in which the project data is stored. You don't need to touch this folder.

Installing IntelliJ IDEA: Setting Up a Java Development Environment
Install IntelliJ IDEA: Set up a Java development environment

Step 9: Create the first Java class

Right-click the src folder, choose New and then Java Class. Name the class MyMain. IntelliJ automatically creates the file MyMain.java in the source directory. The file name and the class name must match exactly, otherwise Java cannot process the program correctly. So also pay attention to upper and lower case.

Install IntelliJ IDEA: Set up a Java development environment
Installing IntelliJ IDEA: Setting Up a Java Development Environment

Step 10: Enter the main method

Inside the class, you write the method public static void main(String[] args). Each of its components has a meaning: public makes the method callable from outside, static ensures that it runs without an instance of the class, and void means that it returns nothing. The name main is fixed because the runtime environment uses exactly this method as the starting point. The array String[] args accepts arguments that are passed in when the program is called. For now, you don't need to do anything with it. The detailed background will follow in later lessons.

Step 11: Program the first output

Inside the main method, you write System.out.println("IDE und Java funktionieren");. This command outputs a text to the console. While typing, you'll notice that the IDE makes suggestions and lets you look up methods such as println directly. With Ctrl-click or Cmd-click, you can jump to the source code. The method println exists in several variants that differ in their parameters. For text, you use the variant with String.

Installing IntelliJ IDEA: Setting Up a Java Development Environment
Installing IntelliJ IDEA: Setting Up a Java Development Environment

Step 12: Run the program

Via the menu or the green play button at the top right, you start the program with "Run MyMain". At the bottom of the window, the code is compiled and executed. The text "IDE und Java funktionieren" appears in the console. Feel free to change the text, for example by adding an exclamation mark, and run it again. After the first run, the buttons for Run and Debug additionally appear at the top. You will get to know the debugger in a later lesson.

Install IntelliJ IDEA: Set up a Java development environment

Step 13: Final check of the environment

First, copy the code exactly as it was shown and run it locally. Only when the output appears is it ensured that Java, compiler and IDE work together. Without this foundation, the following lessons cannot be worked through sensibly.

Installing IntelliJ IDEA: Setting Up a Java Development Environment

Summary ??? Installing IntelliJ IDEA: Setting up a Java development environment

You have downloaded, installed and started IntelliJ IDEA Community Edition from the official website. You have created a Java project, created a class with a matching file name and written a main method. You have successfully run your first program. Your development environment is now ready for all further lessons.

Jan Brinkmann
Trainer About Jan Brinkmann Web development with passion! Jan has been a developer for over 15 years. All courses by Jan Brinkmann