How To Install IntelliJ IDEA for Java on Ubuntu

How To Install IntelliJ IDEA for Java on Ubuntu

Provides all the steps required to install IntelliJ IDEA for Java development on Ubuntu 18.04 LTS. It also shows how to create the Hello World Project using IntelliJ IDEA.

September 07, 2019

IntelliJ IDEA is the smartest IDE for Java development. It's also the base of the official Android IDE i.e. Android Studio used for Android mobile application development. This tutorial provides all the steps required to install IntelliJ Idea on the popular Linux based system i.e. Ubuntu 18.04 LTS for Java development. The same installation can be used for Android application development using either Java or Kotlin. The steps should be the same for other distributions of Linux systems.

It assumes that Java is already installed on the system. You may also be interested in How To Install OpenJDK 12 On Ubuntu and How To Install Java 11 On Ubuntu.

Download IntelliJ IDEA

Click here to navigate to the IntelliJ IDEA's download page. It will open the download page as shown in Fig 1.

Intellij IDEA Download

Fig 1

The IntelliJ IDEA provides two different installers i.e. Ultimate and Community. The Ultimate edition is commercial version whereas the Community edition can be used for free. This tutorial shows the steps required to install the Community edition. The differences between both the editions are shown in Fig 2.

Intellij IDEA Editions

Fig 2

The Community Edition provides essential features required to develop Java applications. It supports Java, Kotlin, Groovy, Scala, Android, Maven, Gradle, SBT, Git, Svn, and Mercurial out of the box. The Ultimate edition also provides more advanced features including Perforce, JavaScript, TypeScript, Database Tools, Duplicates Detection, and supports frameworks including Spring, Play, Grails, etc.

Install IntelliJ IDEA

In order to install the Community Edition downloaded in the previous section, extract the download to the desired location. Make sure that the disk has at least 2 GB of free space since the installation will consume approx 1.1 GB of the available disk space. The steps remain the same for the Ultimate Edition.

Navigate to the bin directory of the extract as shown in Fig 3.

Intellij IDEA Bin

Fig 3

It shows the logo of IntelliJ IDEA and the executable file as highlighted in Fig 3.

Create Desktop Shortcut

In this step, we will install the GNOME panel and use the same to create a desktop shortcut to execute the IDE installed by us in previous steps.

# Refresh packages indexes
sudo apt-get update

# Install GNOME Panel
sudo apt-get install --no-install-recommends gnome-panel

# Create Desktop icon
gnome-desktop-item-edit ~/Desktop/ --create-new

Now configure the IDE desktop shortcut as shown in Fig 4. We will use the IntelliJ IDEA icon available in the root of the installation directory as highlighted in Fig 3.

Intellij IDEA Desktop Shortcut

Fig 4

Execute IntelliJ IDEA

Now launch the IDE using the desktop shortcut created by us. The system will ask permissions to trust the desktop shortcut created by us as shown in Fig 5.

Intellij IDEA System Permission

Fig 5

Click on the Trust and Launch Button to launch the IDE. It will ask to import settings from the previous installation as shown in Fig 6.

Intellij IDEA Import Settings

Fig 6

Choose the location to import setting or simply skip it as shown in Fig 6. Click on OK button to launch the IDE. The next dialog will ask to accept Privacy Policy as shown in Fig 7.

Intellij IDEA Privacy Policy

Fig 7

Accept the Privacy Policy and click on Continue Button. The Next Screen will ask to allow Data Sharing with IntelliJ as shown in Fig 8.

Intellij IDEA Data Sharing

Fig 8

I have clicked on the Send Usage Statistics Button. You may deny the same by clicking the Don't Send Button. The next screen will show the options to configure the IDE on the first launch. The very first option is to choose a theme as shown in Fig 9. I have skipped the rest of the options with default settings.

Intellij IDEA Choose Theme

Fig 9

Click on the Skip Remaining and Set Defaults Button to start the IDE. You may further configure by clicking on the button at button right corner. It will also ask to create a new project or Import Project for the first time as shown in Fig 10.

Intellij IDEA Welcome

Fig 10

We will create the first project i.e. Hello World. Click on the Create New Project option to start creating the project. It will show the screen to configure the project as shown in Fig 11.

Intellij IDEA New Project

Fig 11

I have kept the default options as shown in Fig 11. Now click on the Next Button to continue with project setup. The next screen provides options to choose Project Template as shown in Fig 12.

Intellij IDEA Project Template

Fig 12

Click on the Next Button to configure project name and location as shown in Fig 13. I have provided the project name as Hello World and select an appropriate location to store project files.

Intellij IDEA Project Name

Fig 13

Now click on the Finish Button to create the project. It will also ask to create the directory as shown in Fig 14.

Intellij IDEA Project Directory Permission

Fig 14

Click on the OK Button to grant permission. It will launch the IDE showing Tip of the Day as shown in Fig 15.

Intellij IDEA Project Home

Fig 15

The IDE will show the Hello World project set up on the left panel with all the default options.

Hello World

In the previous sections, we have downloaded and installed IntelliJ IDEA for Java development and also create the Hello World project as part of the process to launch the IDE. In this section, we will write our first Java program and execute it to print Hello Java on the console.

Expand the Project Hello Word and right-click on the src folder, hover on New Option and click on Java Class Option to start creating Java files. It will show the New Java Class Dialog as shown in Fig 16.

Intellij IDEA Java File

Fig 16

I have provided the Java Filename with the package as shown in Fig 16. Now press Enter Key to create the packages and Java file. It will open the Java file as shown in Fig 17.

Intellij IDEA Java File Window

Fig 17

I have updated the HelloJava class to print Hello Java !! on the console as shown in Fig 18.

Intellij IDEA Java Program

Fig 18

Now right click on the HelloJava class file and choose Run HelloJava.main() Option or press Ctrl + Shift + F10 to compile and execute the program. It will also build the project. The final output of the program will be displayed on the console as shown in Fig 19.

Intellij IDEA Program Output

Fig 19

This is how we can install IntelliJ IDEA on Ubuntu 18.04 LTS and create the Hello World project to execute our first program in Java.

Write a Comment
Click the captcha image to get new code.
Discussion Forum by DISQUS