Introduction to JetBrains IntelliJ IDEA Community Edition

In this post I will introduce to you the JetBrains IntelliJ IDEA, one the most powerful IDE (Integrated Development Environment) for Java development or other languages that run on the JVM such as Groovy and Scala. IntelliJ IDEA comes in two editions, the IntelliJJ IDEA Ultimate Edition and the IntelliJ IDEA Community Edition.

The IntelliJ IDEA Community Edition is an open source version of Intelli IDEA. That’s mean you can use it for free. If you work with standard Java, Groovy, Scala or mobile development using Android then the Community Edition can be your choice. If you work with in web or Java EE development then the Ultimate Edition is the way to go.

Here are some features that you will get when using the IntelliJ IDEA Community Edition:

  • An Intelligent code editor that has all the smarts for understanding Java, XML and Groovy code.
  • Refactorings, code inspections and intentions, super-fast navigation and search
  • Testing framework integration: JUnit and TestNG
  • Build tools support: Ant and Maven
  • Popular version control systems integration: CVS, Subversion and Git
  • Swing UI designer

After a bit of introduction, let’s begin the installation.

Step 1. Getting the Installation Distribution

  • Download the installation package of the IntelliJ IDEA Community Edition.
  • Click Download IntelliJ IDEA Community Edition to go the download page.
  • On the page you can see two editions, select the Community Edition. The current version available when this post was written is the version 12.1.4. You can also see that the download are available for Windows, Mac OS X and Linux. For this post I will download the Windows version. The download size for the Windows installer is around 130 MB.

Step 2. Install IntelliJ IDEA Community Edition

  • To begin, double-click the installer you’ve downloaded, for example ideaIC-12.1.4.exe.
  • You’ll be greeted with the following screen
intellij-idea-community-edition-setup-step-1

IntelliJ IDEA Setup Welcome Screen

  • Press the Next button to continue.
  • You’ll be asked the installation location. On Windows it will be defaulted to the C:\Program Files directory.
  • Press Next for a couple of times until the installation complete.
  • When you choose to run the IntelliJ IDEA for the first time you’ll get the following screen
Installation Complete Screen

Installation Complete Screen

  • Press OK button to start IntelliJ IDEA for the first time. You will be shown a splash screen right after you press the button and continued by the screen welcoming you to the IDE.
Welcome to IntelliJ IDEA

Welcome to IntelliJ IDEA

Step 3. Now you have the IntelliJ IDEA Community Edition installed in your machine. Let’s create your first program using IDEA.

  • From the Welcome Screen above click the Create New Project menu.
  • A New Project dialog window will be shown. In this dialog you can do:
Create a New Project Window Dialog

Create a New Project Window Dialog

  • Enter the Project Type, choose Java Module.
  • Define the Project Name. We’ll just name it HelloWorld.
  • Choose the Project Location directory.
  • Select the JDK version you’ll be using.
  • Press the Next button followed by the Finish button to continue.

Step 4. IntelliJ IDEA Main Window, creating HelloWorld.java

  • Here is the Main Window of IntelliJ IDEA.
IntelliJ IDEA Community Edition

IntelliJ IDEA Community Edition

  • The bigger screenshot of the project explorer panel.
Project Explorer Window

Project Explorer Window

  • Before we create a class let’s create a package.
  • Right-click the src folder, continued by selecting the New and Package menu.
  • Enter the package name, for instance org.kodejava.introduction
  • To create a class right click on the newly created package, select New and Java Class menu.
  • In the Create New Class dialog enter HelloWorld in the Name text field and choose Class from the Kind dropdown selection.
  • Type the following code in the editor.
package org.kodejava.introduction;

public class HelloWorld {
    private String name;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public static void main(String[] args) {
        HelloWorld hello = new HelloWorld();

        String name = "world";
        hello.setName(name);
        hello.sayHello();
    }

    private void sayHello() {
        System.out.println("Hello " + getName() + "!");
    }
}
  • Press Shift + F10 or click the green Run button to execute your code.
  • And we are done!

Other things you can do next is to learn more about the menu and the keyboard shortcuts that you can use while working with the IDE. One good place is to look at the Help, Tip of the Day menu.

That’s finishes our introduction to the IntelliJ IDEA Community Edition IDE. I hope you can continue your learning and this IDE will surely help you to understand Java better. Because it is not just a tool to write code, it will give you a lot of suggestion so that you can always improve your code quality.