[JAVA] IntelliJ starting from 1


It's about time I wanted to do server-side, Windows Application, and Android development with Java, so I decided to introduce an integrated development environment. Initially, I was planning to install Eclipse, but I stumbled upon the JUnit settings </ s>, and I had a lot of thoughts, so I decided to install IntelliJ. It seems to be proud of 2nd share next to IntelliJ and Eclipse, and above all, I like the modern UI. It seems that the execution speed of Eclipse becomes slow as soon as it is set to the Japanese environment.

As an aside, I learned about Netbeans after building the environment.

What I wanted to do

  • I wanted to touch the IDE
  • I wanted to do a Java unit test
  • I wanted to develop in collaboration with GitHub


O S:Windows8.1 Pro(x64) CPU:Core i5-4300M CPU 2.60GHz RAM:4.00GB JDK:8u121(Windows x64) 172.png


  • IntelliJ Download
  • IntelliJ installation
  • Start IntelliJ
  • JDK installation
  • Pass the path to the JDK
  • Create test class
  • Try to test
  • Cooperation with GitHub
  • IntelliJ editor settings

IntelliJ download

Download IntelliJ from here (https://www.jetbrains.com/idea/). It seems that IntelliJ has a paid version and a free version, but this time I chose the free version. See here for more details.

  1. Should I choose Community (free) or Ultimate (paid)? If you just want to develop Java, Groovy, Scala or Android applications, use the open source and free IntelliJ IDEA Community Edition. When developing web applications and enterprise applications, we recommend Ultimate Edition, which comes with a number of tools and has extensive framework support. You can also try it for free for 30 days.

IntelliJ installation

Run the downloaded installer. Basically, if you follow the message, you should not be confused by the installation itself. ICOPY001.png

Start IntelliJ

Installation screen

ICOPY002.JPG Select below if you do not want to import settings.

Import environment

ICOPY003.JPG Select "Accept".

Tutorial launch

ICOPY004.JPG The tutorial starts.

Project creation

ICOPY005.JPG Create a new project from "Create New Project".

ICOPY006.JPG Here, select "Java" to create a project, but ... Since the JDK environment is not ready, move on to the JDK settings from here.

JDK installation

Install J </ strong> avaSE D </ strong> evelopment K </ strong> it.

JDK download

The version at the time of writing was 8u121. Download the latest version of the JDK from here. 171.JPG Click "Accept License Agreement" and download the one that suits your environment.

JDK installation

ICOPY007.JPG Proceed with the installation. This area is omitted. Make a note of only the installation destination, as it will be required for the work through the next path. Reference: C: \ Program Files \ Java \ jdk1.8.0_121 \ bin

Pass the path to the JDK

After installing the JDK, add the environment variable Path.

Add environment variable

173.png Invoke the "System" screen.

174.JPG Call the "System Properties" screen from "Detailed System Settings". Click "Environment Variables" at the bottom of the "Detailed Settings" tab.

175.png When the "Environment Variables" screen opens, select "Path" in "System Variables" at the bottom of the screen. After selecting, click "Edit".


Enter; at the end of "Variable value" and copy and paste the path to the JDK that you wrote down earlier. When there are multiple variables, multiple variable values can be set by separating them with ";". Refer to this area.

Check Path

177.png From the command prompt

java -verison

Enter. If the version is displayed, there is no problem. If something goes through but I'm throwing an error, I restarted it for the time being (experience story).

Create test class

Try creating a project from IntelliJ again.

JDK selection

ICOPY008.JPG Create a project from "Create New Project" as usual. Select "Java" and select "JDK" from "New" on the right side of "Project SDK".

ICOPY011.JPG Select the local JDK path you just installed and click OK.

ICOPY012.JPG The screen will return to the original screen, so select the JDK you set earlier from the list box. After selecting, click the "Next" button.

Creating a project

ICOPY013.JPG Click "Next" without playing with it.

ICOPY014.png Enter the project name and click "Next".

Creating a test class

ICOPY015.JPG Right-click "src" in the project and select "New"-> "Java Class".

ICOPY030.JPG Write a class (calc) appropriately.

public class calc {
    public int sum(int x, int y)
        return x + y;

Creating a test directory

ICOPY016.png Right-click on the project → select "New" → "Directory".

ICOPY017.JPG Enter the directory name.

ICOPY018.png Select "Files"-> "Project Structure".

ICOPY019.JPG Select "Modules" from the left menu, right-click on the Tests created earlier, and select "Tests".

Creating a test class

Generate a test class

ICOPY020.png Right-click on the created Class "calc" source code. Select "Go To" → "Test".

ICOPY021.png Select "Create New Test ...".

JUnit 4 selection

ICOPY022.JPG Select JUnit 4 from "Testing library". Check "startUp / @ Before" and "tearDown / After". Also check the functions in Member. Click the "Fix" button next to "JUnit 4 library not found in the module".

ICOPY023.JPG A window will be displayed, so check "Use'JUnit4' ..." and click "OK".

Try to test

Write a red test

ICOPY024.JPG Write the test on the newly generated module.

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

public class calcTest{
    public void sum() throws Exeption {
        calc obj = new calc();
        assertEquals(1, 1 + 1);

Pass the test in red

ICOPY025.JPG Select the upper tab "Run"-> "Run"-> "calcTest" to execute. Alternatively, use the shortcut key "Alt + Shift + F10" to execute.


Pass the test in green

ICOPY027.JPG Rewrite the code so that it passes on the green and execute it.

Cooperation with GitHub

The author was exhausted around here. We will quietly borrow the wisdom of our predecessors. As a matter of fact, I haven't really understood the feeling of Git yet, so that's a topic for the future.

IntelliJ editor settings


Aye! Integrated development environment Yatter! … But to be honest, I can't deny the feeling that it is still being used for its functions. It will take a long time to get used to it because it is multifunctional. In the first place, getting used to Java coding itself is one of the challenges ... I wish I could make something interesting with Java as well as getting used to it.

Recommended Posts