How to install JDK + Maven + IntelliJ + JUnit on Ubuntu Linux 14.04

Currently, I’m learning test automation. The tools I’m using are: Java Development Kit(JDK), Apache Maven, IntelliJ IDE and JUnit. I have easly installed them for MS Windows but installation for Ubuntu linux was a little challenging for me, that’s why I decided to write this article. I really hope the article will be helpful for those, who wants to use those tools in Ubuntu linux. At least you can find all you need here, one source makes it easier 🙂 The article is good for Ubuntu 14.04.3 and actually, it should be good for 15.10 with a little difference in JDK installation. (JDK 8 is available from Ubuntu Software Center in Ubuntu 15.10). Let’s start!

Java SDK installation.

First of all we need to install Java Development Kit. I was thinking to use Ubuntu software center for this installation, but OpenJDK Java 7 Runtime is the latest version available there. According to Oracle current version is Java SE Development Kit 8u66, I actually like to use latest versions, and I’m going to use that one for installation here. For this installation we need to add PPA repository from webupd8team and install JDK from there. So, let’s open our Terminal and run these commands:

$ sudo add-apt-repository ppa:webupd8team/java
$ sudo apt-get update
$ sudo apt-get install oracle-java8-installer

We should check which version of Java we have installed now. Run this command:

$ javac -version

That command returned the following message:

javac 1.8.0_66

Which is a good sign though 🙂 I expected something like that 🙂 We’ve got our Java Development Kit installed!
As I mentioned in the beginning, in Ubuntu 15.10 this installation can be done from Ubuntu Software Center which is easier. The next our step is going to be:

Maven installation.

Since we’ve got JDK installed, now we’re going to install Maven. To do that let’s open Maven web page here and check which current version do they have. I found that current version is 3.3.9 and we can download this file from the site or just run following command from terminal:

$ wget

I use /usr/local/mvn folder for Maven installation, we need to create it first:

$ sudo mkdir /usr/local/mvn

Then we need to move our downloaded archive to newly created folder:

$ sudo mv /usr/local/mvn

Let’s change folder to /usr/local/mvn and unzip Maven archive there.

$ cd /usr/local/mvn
$ sudo unzip

Maven installation path will be:


Now, we need to add /usr/local/mvn/apache-maven-3.3.9/bin folder to PATH variable. This is required for correct Maven operation.

$ export PATH=/usr/local/mvn/apache-maven-3.3.9/bin:$PATH

Also, for correct Maven and IntelliJ operation we need to set JAVA_HOME variable. We can do that like this:

$ export JAVA_HOME=/usr/lib/jvm/java-8-oracle/bin

Then we need to check if it works:

$ echo $JAVA_HOME

Expected output is:


Those variables will last until bash is running, if you close terminal or restart your computer they’re going to be lost. So, we need to make those changes permanent, we need to open current user’s home folder:

$ cd ~

Then open nano editor(I prefer nano because it’s easy to use) and edit the file .bashrc which is hidden file in current user’s folder.

$ nano .bashrc

And under comments starting with # we need to add these lines:

export PATH=/usr/local/mvn/apache-maven-3.3.9/bin:$PATH
export JAVA_HOME=/usr/lib/jvm/java-8-oracle

Our .bashrc file should look like this:

# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
export PATH=/usr/local/mvn/apache-maven-3.3.9/bin:$PATH
export JAVA_HOME=/usr/lib/jvm/java-8-oracle

# If not running interactively, don’t do anything
case $- in
*i*) ;;
*) return;;

After that, you can expect that your variables are set permanently. You don’t need to worry about them any more. We’ve got Maven installed!
Let’s try and make sure it works! Run this command:

$ mvn -v

Expected output should look like this:

Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T11:41:47-05:00)
Maven home: /usr/local/mvn/apache-maven-3.3.9
Java version: 1.8.0_66, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-8-oracle/jre
Default locale: en_US, platform encoding: UTF-8
OS name: “linux”, version: “3.19.0-39-generic”, arch: “amd64”, family: “unix”

If our output looks good then our Maven works and we can proceed with IntelliJ installation!

IntelliJ IDE installation.

IntelliJ can be downloaded from it’s official web site Community version is free, which is good for us! Let’s download it to our Downloads folder. After archive is downloaded we can use any folder we like to install it. I’m going to install it to ~/Apps/IntelliJ folder, but you can use any other folder you like.

$ mkdir ~/Apps

Then move our downloaded archive to that folder:

$ cd ~/Downloads
$ mv ideaIC-15.0.1.tar.gz ~/Apps

After that we’re going to go to that folder and extract our IntelliJ there.

$ cd ~/Apps
$ tar xvfz ideaIC-15.0.1.tar.gz

I like to use shorter names in my paths, so I’m going to rename folder idea-IC-143.382.35 where I extracted the IDE to IntelliJ

$ mv idea-IC-143.382.35 IntelliJ

Then change folder to ~/Apps/IntelliJ

$ cd ~/Apps/IntelliJ/bin

And start the app:

$ ./

Follow the wizard to install the IntelliJ the way you like it. The IntelliJ icon will be created during installation, so you won’t have to run IntelliJ from the terminal all the time.

When you create your first project with Maven there is a chance that IntelliJ won’t find Project SDK! You need to click on New… button and select the path to JDK folder, something like this:


After that your SDK should appear there every time you create your new project.

I hope you could make through that installation and you have IntelliJ installed and working good! Let’s continue with JUnit.

JUnit installation.

After you created your new project, there should a file named pom.xml in your project hierarchy. Current JUnit version you can find at JUnit web site. For now the version is 4.12. To install that version we need to add following code under 1.0-SNAPSHOT of our pom.xml file.


And after that in the popup window click on Enable Auto-Import.

To check if JUnit works, create a new class, add @Test notation before new method. Select @Test and press Alt + Enter select Import Class. JUnit class should be imported successful. And our class should have something like this:

import org.junit.Test;

Thanks for reading! I hope this article could help you to install all those tools for your Ubuntu 14.04.3 OS. Good luck with your automation 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *