IntelliJ IDEA

IntelliJ IDEA is a Java (Maven, Gradle, JavaFX, Junit) and Kotlin IDE powered by JetBrains in a free and a paid version.

πŸ‘‰ JetBrains IDEs share many features explained here.

Features

  • 🌱 can easily install Java JDKs, and switch between versions
  • πŸš€ recognize old code snippets and suggest upgrades
  • πŸ”₯ recognize common mistakes and suggest fixes
  • ⏳ can generate common code snippets (equals, getters...)
  • ...

Product-specific features

Java JDKs

Press CTRL+ALT+MAJ+S or βš™οΈ > Project Structure.

Navigate to the Project tab. From there, you can download a JDK, or select the JDK used for this project.


Add libraries

Press CTRL+ALT+MAJ+S or βš™οΈ > Project Structure.

Navigate to the Libraries tab. Click on +. By selecting "Java", you can import JARs. By selecting maven, you can download JARs from maven repository (use the search bar within the IDE).


Junit

IDEA natively supports JUnit5. Simply write a @Test in a class, then they will prompt you to import JUnit5.

For JUnit4, you may have to do it manually.

πŸ”₯ Use CTRL+SHIFT+T to generate a test class.


Gradle

Each time you edit Gradle files, you'll have to reload gradle. A "reload" icon will pop up within the file.

On the right, there is a "Gradle" tab to run tasks with one click.

To run gradle from a terminal, set JAVA_HOME and use:

PS> $Env:JAVA_HOME="C:\Users\user\.jdks\some_sdk"
PS> .\gradlew.bat

Run Configurations

Similarly to other software, there are configurations where we can set which javac/java options, program arguments...

configurations-idea

Once inside, not all fields are shown. For instance, to see javac options, you need to click on Modify options > add VM options.

Project Folders

Press CTRL+ALT+MAJ+S or βš™οΈ > Project Structure.

Navigate to the Modules tab, then "Sources". From there, you can set:

  • Source folders (folders with .java)
  • Build folders (folders with generated files)
  • Tests folders (folders with testing files)
  • Resources folders (folders with images/... for use in a JAR)