gettingtoknowIntelliJIDEA Community
gettingtoknowIntelliJIDEA Community
1
Getting to Know IntelliJ IDEA (Community Edition)
Table of Contents
Dedication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
About the authors. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Trisha Gee . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Helen Scott. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
What’s new in the second edition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
New UI changes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
AI Assistant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Other changes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
The fundamentals remain the same . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Getting the most from this book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Who should read this book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Signposts to look out for . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
IntelliJ IDEA versions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
A note about shortcuts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Feedback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Technical reviewers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Translation help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Cover design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
I: Getting to Know IntelliJ IDEA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
1. What is IntelliJ IDEA? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
1.1. What is IntelliJ IDEA? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
1.2. Who makes it?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
1.3. Community Edition versus Ultimate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
2. The IntelliJ IDEA guiding principles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
2.1. Always Green . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
2.2. Keyboard First. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
2.3. In the Flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
3. Installing IntelliJ IDEA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
4. IntelliJ IDEA out of the box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
4.1. Welcome screen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
4.2. New UI. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
4.3. Tip of the day. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
4.4. Balloon notifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
4.5. Tool window buttons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
4.6. Tool windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
4.7. Main Toolbar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
4.8. Editor tabs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
4.9. Status bar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
4.10. Editor. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
2
Table of Contents
3
Getting to Know IntelliJ IDEA (Community Edition)
4
Table of Contents
5
Getting to Know IntelliJ IDEA (Community Edition)
6
Table of Contents
7
Getting to Know IntelliJ IDEA (Community Edition)
Dedication
To friendship. It ebbs and flows. If you ride the waves you can achieve so much together.
8
About the authors
Trisha Gee
Trisha is a Java Champion, author of Head First Java, and was an IntelliJ IDEA Advocate at JetBrains for
seven years.
Before working for JetBrains, Trisha built up experience using IntelliJ IDEA while pairing with other, much
more experienced, developers. She was blown away by how much you can achieve if you really
understand the tool, and horrified that she’d been using IDEs to develop Java applications for ten years and
barely scraped the surface of what they could do. This inspired her to move into developer advocacy and
give live coding demos of how to be effective with Java, while at the same time showcasing what you can
do with an IDE.
Trisha’s passion is developer productivity, and learning how to make the most of the tools available to you
is key to being productive.
You can find out more about Trisha on her website [https://trishagee.com/].
9
Getting to Know IntelliJ IDEA (Community Edition)
Helen Scott
Helen is a Java Developer Advocate at JetBrains where she enjoys the variety of tasks that the role affords
her. She started her career a long time ago (in a galaxy far far away) as a Java developer using tools such as
Vim; IDEs were only just being released back then! After a couple of years, Helen chose to pursue a career
in Technical Writing to join her passions for working with developers and content creation.
Helen returned to the world of Java in 2020 when she joined JetBrains as a Java Developer Advocate where
she was inspired by what IntelliJ IDEA can do to support developers. She has since rekindled her fondness
for Java and delivers blogs, tutorials, videos, talks and apparently a book(!) on everything to do with IntelliJ
IDEA and its community.
It’s safe to say that Helen is a huge fan of the product and wishes it had existed when she first started
working with language!
You can find out more about Helen on her website [https://helenjoscott.com/].
10
What’s new in the second edition
Before we summarise the changes to IntelliJ IDEA, and other IntelliJ-based IDEs, it’s worth saying that
change is hard. However, the New UI is a much cleaner interface that reduces clutter and addresses some
of the legacy issues that the IDE was facing by virtue of it being a 20-year-old product that has evolved over
the years.
In IntelliJ IDEA 2023.3, the version we’re using in this book, the New UI is the default for
all new users of the IDE, which includes existing users if they delete all their settings and
install the IDE from scratch. Existing users who migrate their settings from version to
version will have the classic UI by default and will need to enable the New UI in order to
use it.
We recommend that you turn the New UI on in your Settings (⌘, | Ctrl+Alt+S), if it’s not already enabled,
and spend a bit of time finding your way around; it won’t take you long to get used to it!
Trisha Tip
I’m the sort of person who hates it when the UI of something I use all the time
changes. I hate that nothing is where I expect it to be, and I don’t like that it doesn’t
look the way I expect. However, it took me almost no time to adapt to the New UI of
IntelliJ IDEA. Unusually for me, I preferred it almost immediately. When I had to
switch back to the old one (mostly to take screenshots for the previous edition of this
book!) I was grumpy at having to use the "dated" old UI.
New UI changes
Overview
The new themes not only look great, but they bring with them consistency and contrast where needed. The
icons are cleaner and nicer to look at and the font has been modernised too.
Tool windows
The Tool windows have been overhauled both in terms of icons, placement and keyboard shortcuts to
them. In addition, the buttons are bigger and the shortcuts to them are no longer on the buttons. This
means if you want to know the keyboard shortcut you need to hover over the Tool window in question. We
know that some of you might miss this feature, however with the prettier icons, the interface does look
cleaner without the numbers. In addition, Tool windows can be split vertically or horizontally to suit your
needs.
The Quick Launch button has been removed in favour of a new More tool windows link which you can
access by clicking on the ellipsis button below default tool windows on the left of the IDE in the default
layout. We’ll show this in Ch. 4, IntelliJ IDEA out of the box.
Main toolbar
11
Getting to Know IntelliJ IDEA (Community Edition)
The New UI has completely revamped the top part of the IDE. Instead of a Navigation bar and several
clusters of icons, there’s a new Main toolbar. This contains widgets which have been introduced to group
functionality in the IDE, so you know where to look. The Main toolbar is your one-stop-shop for managing
your projects, the VCS actions you use the most and of course, running and debugging.
Navigation bar
The Navigation bar has moved from the top to the bottom and now sits in the Status bar at the bottom of
the editor window.
Editor
The editor has two main changes. Firstly, you might notice that tabs use more space and have a bigger font
for legibility. Editor tabs also now benefit from coloured highlighting that mirrors their appearance in the
Project tool window.
AI Assistant
In 2023 everyone was talking about how AI can help developers be more productive. We have added a
chapter to this second edition on JetBrains' AI Assistant in IntelliJ IDEA, with some tips on how to use it.
Other changes
Each version of IntelliJ IDEA brings new features, improvements, and sometimes changes to existing
behaviour. The second edition of Getting to Know IntelliJ IDEA has been updated to reflect the behaviour
of IntelliJ IDEA 2023.3. Most of the behaviour, settings and general workflow remains as it was in IntelliJ
IDEA 2022.2, the version we used for the first edition. The areas that saw the most change were:
• Dependencies. Package search, which adds the Dependencies window to IntelliJ IDEA, is now a
separate plugin and not a default part of the IDE. Both chapters covering dependencies have been
updated to reflect this.
• Code Coverage. Setting up IntelliJ IDEA to find how much of your code is tested has changed a bit, so
we’ve updated the advice on how to do this.
• Version Control. The UI has changed for version control, mostly because what was available in the
Status Bar is now in the Main toolbar. There were a few behaviour changes too, specifically around
how IntelliJ IDEA runs analysis and checks on your code when you commit it. All the VCS sections of the
book now reflect the new way IntelliJ IDEA works.
• Code With Me. The UI and functionality of Code With Me has matured over the last year or more, so
we’ve updated the Code With Me chapter to include the improvements.
• Java. We’ve updated all the code to use Java 21, the latest Long Term Support release of Java.
• Build Tools. Many of the Gradle projects have been migrated to the Kotlin DSL, since that’s the default
for a number of frameworks these days.
12
What’s new in the second edition
13
Getting to Know IntelliJ IDEA (Community Edition)
Our plan is to get you up and running in IntelliJ IDEA and being productive as soon as possible by learning
from our experiences. Throughout the book we will share a bunch of cool tips and tricks that will help you
to level up your use of IntelliJ IDEA.
Parts II and III contain tutorials. We have limited these to use cases that point you to the key features that
are useful in a wide range of scenarios. Part IV covers specific areas of IntelliJ IDEA, and uses a questions-
and-answer approach to cover the key use cases where you would need these features.
If you are new to IntelliJ IDEA, we recommend you start at the beginning and work through the book in
order. We’ve laid the contents out in the order you’re likely to need it when you’re setting up IntelliJ IDEA
and then creating your first project.
If you’ve used IntelliJ IDEA before, we encourage you to dip into the chapters you need when you need
them. While many of the chapters do build on concepts introduced earlier in the book, each chapter covers
an individual area which should stand alone. Our goal is for you to be able to read a single chapter that
covers something you want to understand better.
That said, those are just our suggestions. We don’t mind where or how you read this book really. We just
hope that you get value from it and learn something that’s useful to you.
At the top level, this book is primarily aimed at Java developers who use, or want to use, IntelliJ IDEA, but
anyone who uses an IntelliJ Platform IDE (for example, Webstorm, PyCharm, Rider) should pick up plenty
of tips.
Your authors come from different backgrounds. Trisha has been using IntelliJ IDEA for over 15 years, and
has used it to develop Java applications large and small for all sorts of organisations. Helen came to IntelliJ
IDEA much more recently, and therefore has a lot of up-to-date knowledge on how to get started effectively.
We want you to benefit from these two viewpoints, so we’ve scattered Helen Hints and Trisha Tips
throughout the book.
14
Getting the most from this book
Trisha Tip
Trisha’s tips are usually her opinions on the "best" way to do things, based on her
experience. All readers should get some insight into the choices that face them for a
particular topic, but more experienced users may find these most helpful.
Helen Hint
Helen’s hints are usually about getting up to speed quickly, and helping you with
any potentially confusing areas. These are valuable for all readers, although new
users will particularly get value from them.
Important Point. This is something all readers should read and remember.
Understanding what’s written in an "Important" block will help you grasp a particular
concept and prevent you from making common mistakes. There are not many of these so
look out for them!
Note. This contains a key concept, where understanding this will help point you in the
right direction.
In Ch. 2, The IntelliJ IDEA guiding principles we’ll cover the principles that will help you understand how to
get the most out of IntelliJ IDEA. These three principles will appear throughout the book:
In The Flow: When you see this icon, you’ll know that this section covers features that help to keep
you "in the zone", that state of flow which is really productive while coding.
Always Green: When you see this icon, you’ll know that this section covers features that keep your
code compiling. IntelliJ IDEA can offer you the most help when your code has no compiler errors, and you
can use it to keep your code compiling even while making big changes.
Keyboard First: When you see this icon, you’ll be learning keyboard shortcuts. Using the keyboard is
much faster than using the mouse, and it can help you stay "in the flow" when muscle-memory takes over
and you don’t have to think about where you need to move the mouse to in the user interface.
We have assumed that you’ll have IntelliJ IDEA open, so you can try out the features, tips and tricks that
we’re covering. We’ll be highlighting specific things to try out with:
Try It!
When you see this icon, we’re asking you to do something in the IDE. When you Try It!, you’ll see
how it works, you’ll learn your way around the IDE, and your fingers will start to learn the shortcuts.
If there’s more detail about the topics covered in a chapter, we’ve added a "More Information" section at
the end of the chapter. This contains links to videos, blog posts, tutorials, help documentation, and so on.
15
Getting to Know IntelliJ IDEA (Community Edition)
Where a feature is relatively new, we mention the version the feature was introduced in. If you can’t find
that feature in your IDE, you’ll need to check which version you’re using.
We have used IntelliJ IDEA Community by default. You can assume the features we cover in the book are
available in both Community (the free version) and IntelliJ IDEA Ultimate (the one you have to pay for).
If we mention a feature that’s only in IntelliJ IDEA Ultimate, we will explicitly say that, and you will
see this IntelliJ IDEA Ultimate logo.
Throughout the book, we will show the keyboard shortcuts for Mac, Windows and Linux. We’ll be using
the default keymap for each of these operating systems. You can download a handy printable reference too
- there’s a link at the bottom of this chapter. In the interests of saving space these will be rendered as
([macOS shortcut] | [Windows/Linux shortcut]). For example, (⌥⏎ | Alt+Enter).
We’ll be using the standard symbols for Mac keyboard shortcuts, rather than spelling out the whole name,
and for Windows and Linux we’ll spell it out.
Here’s a quick reference for Mac users if you’re unfamiliar with the icons, or your keyboard doesn’t have
the same symbols on the keys:
• ⇧ Shift
• ⌘ Command
• ⌃ Control
• ␣ Space
• ⎋ Escape
Feedback
We want to hear from you! You can email us [mailto:[email protected]] with any feedback.
More information
• Default keymap [https://tinyurl.com/yc3u4tdb] (IntelliJ IDEA online help)
• Handy printable reference for IntelliJ IDEA keyboard shortcuts from JetBrains [https://tinyurl.com/
33myzcsv]
16
Acknowledgements
Acknowledgements
This book would not have been possible without the help and support of some very awesome people.
Thank you to Hadi Hariri, Mala Gupta and Marit van Dijk for encouraging us on this personal venture.
Thank you to Josh Long, for showing us it is possible to self-publish a technical book like this one.
Trisha: Thanks to Israel Boza Rodriguez. When you got fed up with Trisha writing Yet Another Book, you
gave advice and time to get it finished! Thanks to Evie and Amy for your constant interest in the progress
of the book, it was extremely encouraging. Thank you to Mike Gee for the use of your house for a four-day
"let’s get this book done" sprint, and for driving me to see Helen on more than one occasion.
Helen: Thanks to Mark Scott for being exceptionally tolerant and understanding of the statement "I’m just
working on the book… I’ll be there in a minute!". Your patience and support enabled me to graduate from
wannabe author to actual author, I appreciate you. I would also like to offer thanks to my almost-two-year-
old dog, but realistically, you are still far more of a hindrance than a help.
Technical reviewers
We have had the benefit of experienced sets of eyes on this book for which we are eternally grateful. Any
errors or omissions are ours and ours alone.
Maarten Balliauw thank you for your suggestions, some text in this book is a literal copy of your feedback.
Yann Cebron your feedback was both thorough and thoughtful; you also enlightened us along the way.
Dalia Abo Sheasha you put your user hat on throughout, and we thank you for it. Your feedback on the
tutorials was very valuable and helped us to take a step back and evaluate our goals.
Translation help
We have a Spanish version of the book (please recommend to your Spanish-speaking developer friends!),
which would not have been possible without the help of developers who speak Spanish natively. Trisha
would like to acknowledge Israel Boza Rodriguez, María Arias de Reyna Domínguez, Jorge Jiménez
Barra and Isabel Garrido.
Cover design
Cover design by the talented Iñaki Salas [https://brandswok.com/]. Thank you! You made our book look like a
real book!
17
Getting to Know IntelliJ IDEA (Community Edition)
• Learn about what IntelliJ IDEA is, who makes it and what the different editions are.
• Discuss the three guiding principles of IntelliJ IDEA that we use throughout this book.
• Give you pointers on how you can get the most from the IDE.
To get started on writing code straight away, you can go to Part II, but to get the most out of IntelliJ IDEA,
we recommend sticking around for the rest of Part I to get to know how IntelliJ IDEA "thinks".
You are reading the community version of this book, thank you for that! This free community version
contains all of Part I of Getting to Know IntelliJ IDEA, but does not include Parts II, III and IV.
18
1. What is IntelliJ IDEA?
Chapter Summary
• What is IntelliJ IDEA?
Android Studio, maintained by Google, is based on IntelliJ IDEA, and the Android features are frequently
merged back into IntelliJ IDEA too.
The second edition is IntelliJ IDEA Ultimate. You need to have a subscription to use the Ultimate version.
There are two different types of subscriptions, one for personal use and one for organisation. If you’re
tempted to pay for it yourself, make sure you’re buying the individual subscription, it’s much cheaper!
Both versions fully support Java, Android and JVM-language (Kotlin, Scala, Groovy) development. The main
differences between Community and Ultimate are:
• IntelliJ IDEA Ultimate has support for Java enterprise frameworks including Spring, Jakarta EE,
Quarkus, Micronaut, Helidon, and more.
• In addition, IntelliJ IDEA Ultimate is more of a polyglot IDE, and provides support for other languages
like SQL, Go, PHP, Ruby, JavaScript and TypeScript. It also supports more frameworks, like Angular,
Node.js, Vue.js, React, Drupal, Django and so on.
More information
• JetBrains office locations [https://tinyurl.com/ypx5e68x]
• IntelliJ IDEA Ultimate vs IntelliJ IDEA Community features from JetBrains [https://tinyurl.com/2ccb87r3]
19
Getting to Know IntelliJ IDEA (Community Edition)
20
2. The IntelliJ IDEA guiding principles
Chapter Summary
• How does IntelliJ IDEA help me to be a more effective developer?
• What three principles should I bear in mind to figure out why IntelliJ IDEA might work in a
particular way?
• How might IntelliJ IDEA encourage me to work differently when compared to working with
another editor?
IntelliJ IDEA helps you to keep your code always green by fixing the problem when and where it
happened. IntelliJ IDEA’s shortcuts enable you to work keyboard first, increasing the speed with which
you can, for example, navigate to and fix errors. All of this leads to you staying in the flow while you’re
developing, keeping you in the context of the problem you’re currently solving and reducing your
cognitive load.
Throughout the book, you’ll see the same three principles crop up again and again:
• Always Green
• Keyboard First
• In the Flow
Together these form what we’re calling the IntelliJ IDEA Guiding Principles.
The IDE will always evolve and change, the user interface will be updated, and features will inevitably be
added or moved. However, these are some fundamentals that we think you should bear in mind to help
you get the most out of working with IntelliJ IDEA, no matter what language or toolset you’re working
with.
IntelliJ IDEA is designed to keep your code compiling all the time. Yes, you can make a change which
breaks compilation and go around fixing all the pieces of code that don’t compile, but usually you won’t
need to do that in IntelliJ IDEA.
What if you’ve called a method that doesn’t exist? No problem, IntelliJ IDEA suggests creating a stub
method that will have the minimum code to keep your project compiling. How about if you want to change
the name of something? You can use IntelliJ IDEA’s Rename functionality, and IntelliJ IDEA will
automatically update the name everywhere.
Trisha Tip
If my code is green as I’m working on it, I can focus on the one thing I’m trying to do
right now. It reduces my cognitive load. Instead of working through a list of errors to
fix and not remembering what caused each error, I rely on IntelliJ IDEA to make the
smallest change needed to keep everything compiling.
21
Getting to Know IntelliJ IDEA (Community Edition)
Much of the functionality in IntelliJ IDEA that we will talk about, such as Live Templates and Code
Generation, work to keep your code always green and compiling by removing an element of human error
such as typos.
Keep an eye out for this icon. When you see it, you’ll know we’re talking about functionality that aims
to keep your code compiling.
IntelliJ IDEA is full of keyboard shortcuts, so our suggestion is to learn just a few to begin with. As you load
these into your muscle memory, you can work at gradually adding more shortcuts to your internal library
until you don’t need to use the mouse for 90% of your day-to-day work.
We will be prioritising keyboard shortcuts and giving you gentle reminders to learn them as you go
through this book.
Helen Hint
You can download and print the keyboard shortcuts - check out the link at the
bottom of this chapter. This is especially useful when you’re training your fingers to
press the right keys!
When you first use IntelliJ IDEA, you’ll be drawn to the mouse and menu items, or buttons, to look for
useful actions. However, you can use Search Everywhere to find any setting, file or action. This should be
your default for "I wonder if I can do…", which is particularly useful if you have a reasonable idea of what
you want to do.
This is your first keyboard shortcut to learn. The shortcut for Search Everywhere is (⇧⇧ | Shift+Shift).
Try It!
Press (⇧⇧ | Shift+Shift) (that’s Shift twice) and see what you can search for! Fun fact: this works in all
the IntelliJ Platform IDEs (such as WebStorm and PyCharm), so no matter what language you’re
using, this will work.
Helen Hint
It can be hard to go straight to keyboard shortcuts. Every fibre of your body might
want to use the mouse/trackpad, but do persevere! The speed gains you will get
from using the keyboard shortcuts out of the box are worth it, I assure you!
22
2. The IntelliJ IDEA guiding principles
red, you can get IntelliJ IDEA to suggest a fix while you still remember what you were trying to achieve.
This means that you won’t need to context switch back to that point later and try to figure out what you
were doing.
IntelliJ IDEA helps you fix problems or sculpt code into a different shape with context-sensitive
suggestions. Your code shouldn’t be red for more than a few seconds. By providing an immediate feedback
loop, your flow is uninterrupted and continuous. IntelliJ IDEA even constantly saves your changes for you.
You don’t need to interrupt your thought process to remind yourself to save your work.
One of the reasons we encourage you to learn the keyboard shortcuts is to stay in the flow - when you’re
reading menu items or moving the mouse around, that split second of moving the focus off what you’re
trying to achieve can break your precious flow.
Being in the flow is about staying in your context for as long as possible. It helps if you can use the IDE to
do all the development-related tasks. Coding? Of course; Previewing files? Yes, absolutely; Seeing values in
the database? Yes (in IntelliJ IDEA Ultimate); Running queries (against a database or using a REPL)? Yes;
Rebasing, cherry-picking, re-writing history? Still yes; Managing version control remotes? Yes; Creating or
reviewing GitHub pull requests? Yes; Remote pair programming? You bet! IntelliJ IDEA excels at keeping
you in the flow.
If some functionality is not part of IntelliJ IDEA by default, there’s almost always a plugin you can use.
You’ll see more about plugins in Ch. 37, Working with plugins.
Bottom Line
• Keep an eye out for the always green, keyboard first, and in the flow elements
throughout this book. These concepts will help you get the most from your IDE.
•
Always green is about fixing errors as soon as they occur, making non-breaking changes as
you develop, and keeping your code compiling.
• Keyboard first is about learning the shortcuts to keep your fingers on the keyboard, which
speeds you up.
• In the flow is about that feeling you get when you’re happy creating your application and
not worrying about any ceremony or distracting tasks - IntelliJ IDEA takes care of those.
• You’ll also come across Try It sidebars too - it’s not always easy to describe exactly how IntelliJ
IDEA can help you, sometimes you need to see it for yourself.
Keyboard Shortcuts
(⇧⇧ | Shift+Shift) to open the Search Everywhere dialog
More information
• IntelliJ IDEA Keyboard Shortcuts Reference Card from JetBrains [https://tinyurl.com/33myzcsv]
23
Getting to Know IntelliJ IDEA (Community Edition)
Chapter Summary
• Which edition of IntelliJ IDEA should I use, Community or Ultimate?
First, you need to install IntelliJ IDEA. If you’ve already done that, you can skip this chapter and head
straight to Ch. 4, IntelliJ IDEA out of the box.
If you’re wondering which edition of IntelliJ IDEA to install, start with IntelliJ IDEA Community Edition
because it’s free! Of course, if you have a subscription to use IntelliJ IDEA Ultimate, go ahead and use that.
All the examples in this book use IntelliJ IDEA Community Edition unless otherwise explicitly stated.
Install whichever is the most recent version of IntelliJ IDEA. This book is based on IntelliJ IDEA 2023.3.
Many features will be the same from version to version, but you will usually get the best performance and
most interesting features if you use the latest version of IntelliJ IDEA. IntelliJ IDEA usually suggests you
update it when a new version is released.
We recommend installing IntelliJ IDEA using the JetBrains Toolbox app. Alternatively, you can download
IntelliJ IDEA as a standalone application. You can find links to documentation for both approaches at the
end of this chapter.
Helen Hint
I love using the JetBrains Toolbox app to manage my IDEs. Yes, granted, I’m using
more than one IDE, but even if it was just one product, the Toolbox app is still
helpful because it manages versions, including the Early Access Program (EAP),
settings and updates for me.
IntelliJ IDEA sets a dark theme when you first install it. However, we have used a light theme and
associated colour descriptions throughout this book because it’s easier to see the screenshots.
More information
• JetBrains Toolbox application [https://tinyurl.com/2xtb4p3w] (JetBrains Toolbox application)
• Installation Guide with the Toolbox app [https://tinyurl.com/4knnkcpd] (IntelliJ IDEA online help)
24
3. Installing IntelliJ IDEA
Bottom Line
• If you don’t have a subscription for IntelliJ IDEA Ultimate, you can install IntelliJ IDEA
Community for free.
• The JetBrains Toolbox app is a great way to manage updates to your products, especially if you
have more than one from JetBrains.
25
Getting to Know IntelliJ IDEA (Community Edition)
Chapter Summary
• What should I expect to see the first time I open IntelliJ IDEA?
• What are the notifications and dialogs that open and what should I do about them?
• What are all the buttons and windows that are open, and do I need them?
• Why does the editor include text that isn’t part of my source code?
Now we have introduced you to the IntelliJ IDEA guiding principles and you’ve installed IntelliJ IDEA, it’s
time to go on a tour.
IntelliJ IDEA is a very powerful tool with a lot of features. We’re going to step through each area of the
interface.
26
4. IntelliJ IDEA out of the box
Try It!
If you have your own Java project that you want to use for this tour, you can press Open from the
Welcome Screen and navigate to it on your local machine. If your project is hosted somewhere like
GitHub, click Get from VCS and paste the link into the URL field, and then click Clone to clone your
project from version control to your machine.
1. Press New Project to start IntelliJ IDEA’s New Project wizard. If you don’t see the Welcome
Screen, you might have a project open already. In this case go to File > New > Project.
2. Give your project a name, such as "getting-started" and change the location if you want to.
3. Select the Create Git repository checkbox, so we can show you the VCS tool window in this
section.
4. You can leave the rest of the defaults in this dialog, but if you don’t have a JDK (Java Development
Kit) downloaded, click Download JDK and choose one from the list before you proceed with a
Java project. You can select both a version and a vendor here and IntelliJ IDEA will manage the
download and configuration of the JDK for you.
5. Press Create and IntelliJ IDEA will load your new project.
IntelliJ IDEA automatically saves its projects in a folder called 'IdeaProjects' in your home directory. On
Windows, this might look something like C:\Users\Trisha\Documents\IdeaProjects, and on macOS, it
might look something like this /Users/HelenScott/IdeaProjects.
27
Getting to Know IntelliJ IDEA (Community Edition)
4.2. New UI
In this second edition of Getting to Know IntelliJ IDEA, we’re focussing exclusively on the "New UI". This
updated user interface was first introduced to beta users in IntelliJ IDEA 2022.3 and has been evolved and
gradually rolled out to more users since then.
The New UI might be on by default in your configuration, or you might need to switch it on manually
depending on your configuration. To enable it, go to your settings (⌘, | Ctrl+Alt+S) and search for new ui.
You can optionally select Compact mode if you prefer less space around the elements in your interface.
You will need to restart the IDE for the change to take effect.
Helen Hint
I prefer to use Compact mode in the New UI. You can enable it in your settings (⌘, |
Ctrl+Alt+S) and search for New UI, then select the Compact mode checkbox.
28
4. IntelliJ IDEA out of the box
Sometimes, these notifications may be questions for you about configuration in your project. For example,
sometimes the notification asks you about downloading pre-built indexes, which generally improves the
performance of IntelliJ IDEA. If you press Always download, IntelliJ IDEA won’t ask you about this again.
29
Getting to Know IntelliJ IDEA (Community Edition)
If you accidentally close the popup, or it disappears, click the Notifications tool window button, the bell in
the top-right. You’ll see all the messages and any "Call To Action" links or buttons.
IntelliJ IDEA can do many clever things because it indexes your project. We will talk about this in more
detail in IntelliJ IDEA’s Internal Map but the short version is that it reads all your files and figures out how
the project is structured and which technologies it uses.
This indexing process is usually a one-off when you first load the project and it can give the impression
that IntelliJ IDEA is slow to start, because it sometimes is, the first time. To speed up the process, IntelliJ
IDEA can download pre-built indexes for technologies your code uses - for example, for the version of Java
you’re using, and for common libraries and frameworks. This way, IntelliJ IDEA on your machine doesn’t
need to build all the indexes for all the code your project uses.
Downloading pre-built indexes can improve the performance of IntelliJ IDEA, particularly on the
initial startup. This functionality is available in IntelliJ IDEA Community for the first 30 days. If you need
the performance improvements from this feature, you should consider using IntelliJ IDEA Ultimate instead.
30
4. IntelliJ IDEA out of the box
31
Getting to Know IntelliJ IDEA (Community Edition)
When you’re getting started, the Project tool window is a great place to start. The Project tool window can
be used to see the files and folders in your project, and you can use it to open your code in the editor. You
can see all your tool windows by clicking on the ellipsis button on the left-hand side of your IDE.
32
4. IntelliJ IDEA out of the box
• The main menu (Windows and Linux). Located under the hamburger icon on the top-left of the IDE.
• The project. Shows the project name and lets you switch between all your recent projects, create new
projects and open existing projects. You can assign a different colour to each of your projects as a visual
cue to help you quickly find the one you want.
• The current VCS branch, if your project is in version control. Clicking on this opens a menu that shows
your branches and contains VCS actions like update project and switch branches.
• Run/debug configurations. This widget shows you a list of your run configurations, as well as the run
and debug actions for the currently selected run configuration. You can make changes to your run
configurations here and see the state of any running processes, including debugging. We will cover
these features in much more detail in Ch. 27, Using Run Configurations effectively.
• Ch. 36, Pairing with code with me, Search Everywhere and Settings, all of which will be covered more in
the rest of the book.
You can also see the files you have recently accessed with Find Recent Files (⌘E | Ctrl+E).
33
Getting to Know IntelliJ IDEA (Community Edition)
On the right-hand side of the Status bar is information about the file that’s open in the editor. For example,
line number, line endings and file encoding. There’s a lot of information here; you can right-click and hide
the information you’re not interested in.
4.10. Editor
Now, the most important part of the IDE - the editor! This is the main pane, where you write and edit your
code.
IntelliJ IDEA shows the text of your file as you’d expect, but it also decorates your code with hints and
information. The grey text inline with the code is called an Inlay Hint. The hints are usually helpful, but
some people find them distracting. See Ch. 7, Tuning your IDE to find out how to configure which hints are
shown.
34
4. IntelliJ IDEA out of the box
Trisha Tip
I recommend giving the "What’s New" page a quick look since this is the best place
to see if any interesting new features have been added or if there are any major
changes.
In this section, we introduced key areas of the user interface in IntelliJ IDEA. In the next section, we’ll give
directions on which areas of the IDE to look at and when.
You will notice that many of the screenshots in this book show a minimalistic user
interface. This is because we have tuned the IDE to save space and show you the most
important information. You can learn how to tune your IDE when you’re ready.
More information
• Download pre-built indexes [https://tinyurl.com/mvj2kmfj] (IntelliJ IDEA online help)
• Customize actions, menus and toolbars [https://tinyurl.com/msufzzay] (IntelliJ IDEA online help)
35
Getting to Know IntelliJ IDEA (Community Edition)
Bottom Line
• You can create a new project, open an existing project on your machine or clone a project from
VCS in the Welcome Screen.
• The Tip of the Day is a great way to learn new things about IntelliJ IDEA.
• Balloon notifications give you helpful information about your project. If you dismiss a balloon
notification and want to get it back, you can click on the notification bell icon in the bottom-right
corner of your screen.
• Tool window buttons appear around the edge of your screen; clicking them opens the
corresponding tool window.
• The Status Bar contains your Navigation bar by default, as well as information about the current
file.
Keyboard Shortcuts
(⌘1 | Alt+1) to open the Project tool Window
(⌘4 | Alt+4) to open the Run tool Window
(⌘9 | Alt+9) to open the Git tool window
(⌃⌥R | Alt+Shift+F10) to display the Run Configurations dialog
(⌘E | Ctrl+E) to display the Recent Files dialog
(⇧⌘A | Ctrl+Shift+A) to open the Find Action dialog
(⇧⇧ | Shift+Shift) to open the Search Everywhere dialog
(⇧⌘F12 | Ctrl+Shift+F12) to hide all the tool windows
(⌘, | Ctrl+Alt+S) to open the Settings dialog
(⎋ | Escape) to exit a dialog, or return focus to the editor
36
5. Where to look
5. Where to look
Chapter Summary
• What are the different areas of the IDE?
When you’re working in IntelliJ IDEA or any IDE, it’s helpful if you have a good idea on which places you
should look for information, support, and of course, help.
In this chapter we will provide guidance, so you can train your eyes to automatically look at the right
areas. In time, this will become second nature to you, but if you’re new to IntelliJ IDEA, it’s helpful to know
where to start.
Errors happen, and IntelliJ IDEA tells you about them immediately, so you can fix them straight away. If
you have the code below in your editor, you will see an error.
IntelliJ IDEA gives you the right information in the right place at the right time. You can press (⌥⏎ |
Alt+Enter) to get IntelliJ IDEA to give you suggestions for fixes.
You also see context-sensitive information, which is shown with yellow highlights for warnings and
suggestions, grey text for unused/unnecessary code, and wiggly underlines for spelling and grammar. You
can see more details about the problem by hovering the mouse over it.
When you press (⌥⏎ | Alt+Enter) here, IntelliJ IDEA gives information about the problem and usually
suggests solutions.
If you’re in the zone writing code, we suggest you look at warnings later. They’re optional suggestions
for you to investigate - your code compiles, but there may be an alternative way to write it.
37
Getting to Know IntelliJ IDEA (Community Edition)
Runnable code has a green run icon next to it. A green arrow at the top of a file lets you run all the tests,
methods, or functions in that file.
Some gutter icons let you navigate to related interfaces, superclasses and subclasses.
Clicking on the gutter icon on line 4 takes you to the method implementation in the class that implements
that interface. From there you can navigate back to the superclass method.
The gutter also shows you the changes that have been made to the visible lines of code since this file was
last committed to version control. You can see at a glance if the code has been added (green), changed
(blue) or deleted (grey).
When you click on these markers, you can get an overview of the changes.
You can roll back the changes from here or show the diff view if you want more detail.
38
5. Where to look
If you’re using a framework like Spring or Jakarta EE, you’ll see specific icons in the gutter. We recommend
hovering over or clicking these icons to figure out how they can help you.
Support for some frameworks, for example, Spring, is only available in IntelliJ IDEA Ultimate.
You can use the right-hand scroll bar to quickly see, for example, that you have three todo comments, some
new code and some warnings you need to look into.
Trisha Tip
Effectively the scroll bar on the right shows you the whole file at a glance without
the file needing to fit on one screen. In contrast, information on the left-hand scroll
bar is shown only for the lines currently visible in the editor.
You can hover over a marker in the right-hand scroll bar to see what it marker represents, IntelliJ IDEA
shows a description of any problems. If the code the marker applies to is not visible in the editor, IntelliJ
IDEA shows a preview of the code in question.
39
Getting to Know IntelliJ IDEA (Community Edition)
The navigation bar and the information on the right of the status bar may give you some context in terms
of where you are and what settings the current file has.
However, you can change the status bar to display useful messages instead. For example, it will show you
the last notification you received, or give you information about the warning or error your caret is on. You
can turn this on by enabling the Status Bar Widgets: Status Text, we’ll talk about how to do this in Ch. 7,
Tuning your IDE.
Trisha Tip
I highly recommend showing the status message in the status bar. The status
message should be one of the first things you check if you want to know if your last
action was successful or if you suspect some error needs to be fixed.
40
5. Where to look
You may want to hide the tool windows (⇧⌘F12 | Ctrl+Shift+F12) when you’re coding to stop yourself
from getting distracted. This means that your eyes are always focused on the code and the code-related
information in the editor. You may want to look at the information in a tool window when you "surface"
from your coding-flow.
• The Commit tool window] (⌘0 | Alt+0) to see which changes you’ve made.
• The Project tool window (⌘1 | Alt+1) to see all the files in your project.
• The Run tool window (⌘4 | Alt+4) to see the output of running your code.
• The Git tool window (⌘9 | Alt+9) to see the status of your Git repository.
Helen Hint
You can always use (⎋ | Escape) to put the focus back in the editor rather than the
tool window at any time.
41
Getting to Know IntelliJ IDEA (Community Edition)
5.7. Dialogs
There are lots of dialogs in IntelliJ IDEA, so here are some tips to guide you through them:
• Escape (⎋ | Escape) closes any dialog without saving any changes you have made.
• You can often use Find Action (⇧⌘A | Ctrl+Shift+A) and then type in the name of the thing you’re
looking for to display the dialog, for example “rearrange code”.
• Almost all dialogs are searchable. That means you can type directly into any dialog box to find the
thing you’re looking for. This is especially useful in the Settings dialog (⌘, | Ctrl+Alt+S), but can also be
valuable in smaller dialogs such as Find Recent Locations (⇧⌘E | Shift+Ctrl+E).
• Some dialogs have checkboxes in them. You can use the same keyboard shortcut to load the dialog to
toggle the checkbox selection on and off. That means there’s no need to reach for the mouse to select
the checkbox. We’ve not found anywhere this doesn’t work yet, but we’ve not checked every dialog
box!
It takes time to understand all these settings, so we recommend that you don’t look at every single setting
to start with. As you read this book, we’ll walk you through the settings you’ll need and how best to change
them.
42
5. Where to look
Helen Hint
Search Everywhere (⇧⇧ | Shift+Shift) should become your new best friend,
especially when you’re new to IntelliJ IDEA.
We discuss the Settings dialog in Ch. 42, Changing IntelliJ IDEA settings in Part IV.
We explore this more in Ch. 40, Deciphering the Project Structure dialog in Part IV.
More information
• Language level [https://tinyurl.com/yw8jvvep] (IntelliJ IDEA online help)
43
Getting to Know IntelliJ IDEA (Community Edition)
Bottom Line
In this section, we’ve tried to give some directions and signposts to areas of the IDE to pay attention
to at particular times. The rest of the book covers many of these areas in much more detail. For now,
you should know what you need to pay attention to.
• The editor is context-aware and gives you visual hints to help you fix errors as you go keeping
your code always green.
• The left-hand gutter may contain gutter icons which help you with running an application,
navigation and frameworks such as Spring.
• The left-hand gutter shows changes in that file if it’s in version control.
• The right-hand scroll bar shows you helpful information about the full file at a glance, including
red markers that indicate errors.
• The Status Bar shows you errors, warnings and information with colour-coded icons and your
version control status. You can also access your notifications from the Status Bar.
• Your Settings and Project Structure (⌘, | Ctrl+Alt+S) dialog are just a shortcut away and allow you
to see and configure all the aspects of your project, but you don’t need to dive in there straight
away. You can use Search Everywhere (⇧⇧ | Shift+Shift) to find settings too.
Keyboard Shortcuts
(⌥⏎ | Alt+Enter) to get suggestions and fixes
(⇧⇧ | Shift+Shift) to open the Search Everywhere dialog
(⇧⌘F12 | Ctrl+Shift+F12) to hide all tool windows
(⌘, | Ctrl+Alt+S) to open the Project Settings dialog
(⌘; | Ctrl+Alt+Shift+S) to open the Project Structure dialog
(⎋ | Escape) to put the focus in the editor at any time
44
6. How IntelliJ IDEA sees your project
Chapter Summary
• What is an IntelliJ IDEA project?
• How does IntelliJ IDEA figure out where my source and test files are?
• Do I need to configure IntelliJ IDEA to be able to compile and run your code?
• What are IntelliJ IDEA modules, and why might I use them?
In this chapter, we will explain how IntelliJ IDEA interprets the structure of your project and represents it.
We will talk about how IntelliJ IDEA builds up its own model of your project, enabling the most useful
functionality of the IDE, like immediate feedback for errors, and suggestions for improvements. Ultimately,
if you understand how IntelliJ IDEA models your code, it will help you to work more effectively with your
project.
Your application may contain a single module or several different modules, but it’s all represented as an
IntelliJ IDEA project. For newer projects, you probably have a .idea folder that contains configuration
files which IntelliJ IDEA uses to load the projects. We will explore this further in Ch. 41, Looking in your
.idea folder in part IV. Older IntelliJ IDEA projects may have .ipr (IntelliJ IDEA Project) files that, again,
IntelliJ IDEA can use to load the project and its modules.
By performing indexing, IntelliJ IDEA builds up a complete map of your code. This means that it
understands the structure of your code. Let’s say you want to rename a method; IntelliJ IDEA can rename
the place that method is declared and everywhere that calls that method in a single operation because of
its internal map. IntelliJ IDEA’s Inspections are also enabled through indexing. This means IntelliJ IDEA can
warn you about issues in real-time, not at a later date. This is why IntelliJ IDEA indexes when you first load
a project; it is building its internal map of your project so it can help you at a later date.
IntelliJ IDEA Ultimate can download pre-built indexes for certain languages, frameworks and
45
Getting to Know IntelliJ IDEA (Community Edition)
libraries. The index for Java 17 for your project is the same for your computer, our laptops, and everyone
else’s; there’s no need for all our computers to build an index for common code each time.
Your project shape determines which tool windows are available. For example, if you are using Maven or
Gradle, IntelliJ IDEA enables a Maven or Gradle tool window, respectively.
46
6. How IntelliJ IDEA sees your project
IntelliJ IDEA uses the build tool configuration to figure out where your source code, test sources and
resource files are.
Helen Hint
The Project tool window also lists the external dependencies, which are labelled
according to where they were defined, for example, Maven or Gradle. The Project
tool window is a good place to find the version of Java you’re using, that is, the
version of your JDK.
Rather than put multiple project in the same window, IntelliJ IDEA offers a couple of ways to easily switch
between open projects.
• Using the Project widget in the window header. From here, you can switch to another open project or
quickly select a recent project. You can also open another project from your computer or source
control, or create a new project.
• If you’re using macOS, you can have all your open projects as tabs at the top of the IDE. Go to Window >
Merge All Project Windows.
47
Getting to Know IntelliJ IDEA (Community Edition)
When you select this, all your projects appear as tabs at the top of your window.
IntelliJ IDEA does have the notion of modules. A project can contain several modules which are related.
This is one way to handle the complexity of the real world - split a project into multiple modules as it
grows. Each module is represented as a folder with a name in bold in the Project tool window.
48
6. How IntelliJ IDEA sees your project
Alternatively, if it shows the name of the current branch, with a branch icon, the project is using version
control.
Alternatively, you can look in the VCS menu and see if you have an Enable Version Control Integration
option. This is shown if the project isn’t using a version control system yet.
If you are using Git, you will see a Git menu instead of a VCS menu. This menu includes options such as
Commit, Push, and Update project. If you’re using Mercurial, the menu will be called Hg. For other
version control systems, you may see a VCS menu with extra options for your version control system.
49
Getting to Know IntelliJ IDEA (Community Edition)
IntelliJ IDEA Ultimate supports several frameworks, for example, Spring, Spring Boot, Micronaut,
Microprofile, Jakarta EE and many more. You can code with these frameworks in IntelliJ IDEA Community
Edition; however, the difference is that IntelliJ IDEA Ultimate gives you lots of help with the supported
frameworks.
IntelliJ IDEA Ultimate automatically turns on support for the libraries and frameworks you use in
your project. You can check and confirm this by going to your Project Structure (⌘; | Ctrl+Alt+Shift+S) and
navigating to the Facets. For example, if you’re working with a Jakarta EE project in IntelliJ IDEA Ultimate,
you should see that the JavaEE Application facet has been added to your project.
We’ll talk about facets a little more in What is an IntelliJ IDEA Facet? in Part IV.
More information
• Inspections [https://tinyurl.com/ydwrj9ds] (IntelliJ IDEA online help)
50
6. How IntelliJ IDEA sees your project
Bottom Line
• IntelliJ IDEA creates its internal map of your project when it indexes it.
• Your build tool defines the shape of your project, and IntelliJ IDEA understands how to structure
your project, often based on a Maven pom.xml file or a Gradle build.gradle.
• Each window contains a single project in IntelliJ IDEA; there is no notion of a workspace.
• You can establish if your project is in version control by seeing if you have a VCS menu.
• Plugins provide additional framework support as well as extend some areas of functionality in
IntelliJ IDEA.
Keyboard Shortcuts
(⌘1 | Alt+1) to open the Project tool window
(⌘, | Ctrl+Alt+S) to open the Settings dialog
(⌘; | Ctrl+Alt+Shift+S) to open the Project Structure dialog
51
Getting to Know IntelliJ IDEA (Community Edition)
Chapter Summary
• An opinionated viewpoint on the Status bar and Editor Tabs in the IDE
You might notice that the screenshots in this book look a little different to your IDE, especially out-of-the-
box. That’s because we tuned the IDE to hide some of the elements in the interface as we both prefer to
focus on a keyboard first approach for accessing this functionality, rather than the mouse.
When you first start IntelliJ IDEA, your interface will look similar to this. We appreciate that this is a busy
screenshot, but it’s helpful for orientation.
In addition, IntelliJ IDEA is an enterprise product with a lot of features, meaning it’s impossible to surface
all the available functionality when you first load the product. IntelliJ IDEA gives you icons and pop-ups for
features, which will help you to do the most common things fastest. This is helpful for new users and also
for giving visibility to new features.
We’re now going to take you on an entirely opinion-based journey about what we like to hide in the user
interface and why. As always, the choice is yours.
52
7. Tuning your IDE
However, as always, you can turn off this toolbar if it doesn’t work for you in the menu with View >
Appearance > Toolbar or by searching for Main toolbar with (⇧⇧ | Shift+Shift) Search Everywhere.
This will hide the navigation information for the project and show the notification messages instead in
your Status bar.
53
Getting to Know IntelliJ IDEA (Community Edition)
The right-hand side of the Status bar can be configured to show more or fewer icons. Right-click on the
status bar to see a list of items to toggle on and off
We like to work with the line and column number of where the caret is in the editor. It’s helpful to have the
notifications icon so you can see if there are new notifications and easily open the notifications window. It
can also be useful to see the Indentation settings.
To turn the editor tabs off, use (⇧⇧ | Shift+Shift) to open Search Everywhere again. Type "tab
placement" and use the arrow keys to move down to the setting for Tab placement | None. Press (⏎ |
Enter) to toggle this setting on.
If you like the Editor Tabs to be on but don’t want them to fill up with files that you’re just taking a quick
look at, you can turn on the Enable Preview Tab from the (⌘, | Ctrl+Alt+S) Settings. This means that files
you click once in your Project tool window will be displayed in the preview tab, indicated by italics in the
associated Editor Tab. If you double-click a file or press (⏎ | Enter) on a file, it will open as normal in your
editor and consume an editor tab as you expect.
54
7. Tuning your IDE
Trisha Tip
Editor Tabs can be a helpful reminder of what you’ve been working on and your
current context. The first time someone suggested I turn them off, I was horrified!
How was I supposed to remember what I was working on if I couldn’t see which
files were open?! However, I started using Find Recent files (⌘E | Ctrl+E) instead
and quickly decided that this was my favourite way to see my current context. Now I
always hide Editor Tabs.
We have hidden the tool window buttons for most of the screenshots in this book to give us more space to
show whatever it is we’re trying to demonstrate in the screenshot. If we’re working on a large enough
monitor, we’ll generally leave them visible in the IDE.
To hide the tool window buttons around the edges of your editor, you can use (⇧⇧ | Shift+Shift) and
type "window button". Press (⏎ | Enter) on View | Appearance: Tool Window Bars to hide them.
You can also press (⇧⌘F12 | Ctrl+Shift+F12) at any time to hide all the tool windows, including any
that are open.
55
Getting to Know IntelliJ IDEA (Community Edition)
• Navigating with the hierarchy on the left-hand side of the dialog: Editor → Inlay Hints
Trisha Tip
I prefer to turn the author hints off, but I haven’t tried it on a project with many
authors. I know plenty of people who use other JetBrains IDEs that have had this
feature in for longer, and they love code vision and its insights.
Depending on which aspects of the user interface you choose to turn off, the IDE will be more code-
focused:
56
7. Tuning your IDE
Bottom Line
We recommend changing the Status bar to show your notifications and turning off Editor Tabs to
maximise the editor window. You may also want to turn off your toolbar buttons and tune the inline
hints and other editor features.
It may take time to get used to this streamlined IDE, but it minimises distractions and helps you focus
on your code.
Keyboard Shortcuts
• (⎋ | Escape) will get you back to the editor irrespective of where you are
57
Getting to Know IntelliJ IDEA (Community Edition)
Chapter Summary
• Where is the documentation kept?
Despite our best efforts, this book cannot cover everything because the IDE is released three times a year
and, rather wonderfully, is continually evolving. We know you might need help at some point so here are
some places to look if you need more information or get stuck.
We’ve added links to all the resources that we’ve mentioned here at the bottom of this chapter.
The online help should be your first port of call when you want to learn how to do something or get help
with a specific feature. Often the team at JetBrains also embed videos into the help pages if they relate to
the content on that page. Given that, we have added several links to the online help for specific features in
some chapters of this book. This is so you know the help pages to go to if you want to explore the
functionality further.
58
8. Where to get help
More information
• IntelliJ IDEA online help home page [https://tinyurl.com/w599cm8s] (IntelliJ IDEA online help)
59
Getting to Know IntelliJ IDEA (Community Edition)
Bottom Line
• There are many places you can go to get help on IntelliJ IDEA.
• Each of the places listed has a different approach, and the right one for your problem depends on
your search term and learning style.
60
Part II: Working with code
In Part II, we’ll look at how IntelliJ IDEA helps you to write and read code. We recognise that this is a large
part of what developers are doing in their day-to-day work. We’ll:
• Introduce the key features that help you write code by walking you through a simple but complete
tutorial.
• Look at how code completion and generation reduce errors in your code and frees you up to work on
more interesting things.
• Show you how to write code that works first, and then use IntelliJ IDEA’s suggestions to reshape it
afterward.
• Give you lots of shortcuts and tips for working with code.
• Show you how to move through your code with keyboard shortcuts.
• Talk about how IntelliJ IDEA can help you to read and understand code.
This part will focus on writing and reading code while introducing some related topics like running and
testing. We will look at these topics in more detail, and introduce more, in Part III.
1. Buy the full version of Getting to Know IntelliJ IDEA. The eBook and PDF versions are available on
Leanpub [https://leanpub.com/gettingtoknowIntelliJIDEA], and the paperback version is on Amazon [https://a.co/
d/27KC3YN].
2. Buy the Working With Code in IntelliJ IDEA course [https://leanpub.com/c/workingwithcodeinintellijidea] from
Leanpub. This hands-on course covers everything from Part II of the book.
More information
• PDF and eBook from Leanpub [https://leanpub.com/gettingtoknowIntelliJIDEA]
61
Getting to Know IntelliJ IDEA (Community Edition)
9. Writing code
Chapter Summary
• How do I create a new project in IntelliJ IDEA?
This free community version does not include the contents of Parts II, III and IV of Getting to Know IntelliJ
IDEA. Read Part II in PDF and eBook [https://leanpub.com/gettingtoknowIntelliJIDEA] or Paperback and Kindle
[https://a.co/d/27KC3YN], or take the Working With Code in IntelliJ IDEA course [https://leanpub.com/c/
workingwithcodeinintellijidea].
62
10. Creating code quickly
Chapter Summary
• What sort of suggestions can IntelliJ IDEA offer while I’m coding?
• How can I get IntelliJ IDEA to generate common code for me?
• How does IntelliJ IDEA help me to keep my code compiling, even when I’m coding something
new?
63
Getting to Know IntelliJ IDEA (Community Edition)
Chapter Summary
• What do the red and yellow warnings mean in IntelliJ IDEA?
• How can IntelliJ IDEA help me if I think my code could be written differently?
64
12. Activating your muscle memory with Keyboard Shortcuts
Chapter Summary
• What’s so special about using the keyboard?
65
Getting to Know IntelliJ IDEA (Community Edition)
Chapter Summary
• How can I quickly find something, whether it’s in my project code or in the IDE itself?
• How can I easily move through the code I’m working on?
• What shortcuts can I use to get a better understanding of the code and how it works?
66
14. Understanding code
Chapter Summary
• How does IntelliJ IDEA help me to understand code in the editor?
• What extra information can IntelliJ IDEA show me to give me more context for the code?
• Where are some other places to look that give me more information about what the code is doing
and how it has changed?
67
Getting to Know IntelliJ IDEA (Community Edition)
• Go through the options for opening different types of projects, including getting them from a version
control server.
• Show several ways to run an application inside IntelliJ IDEA, so you can pick an approach that works
for your workflow.
• Debug an application, so you can learn how IntelliJ IDEA’s debugger can help you see an application’s
state—and how it changes—while it’s running.
• Use tests to drive the design and implementation of a small application, and see how IntelliJ IDEA’s
approach to testing makes it simple to write correct code.
• Show you how to combine automated tests with debugging to troubleshoot problems without having to
debug the whole application.
• Add a new dependency to your project, so you can see how to use external libraries.
• Introduce you to using build tools such as Maven or Gradle with your project.
• Take you through using a version control system to track versions of your project code.
After you’ve got a good handle on these topics, in Part IV we’ll move on to specific IntelliJ IDEA features
that support you while you’re developing applications.
1. Buy the full version of Getting to Know IntelliJ IDEA. The eBook and PDF versions are available on
Leanpub [https://leanpub.com/gettingtoknowIntelliJIDEA], and the paperback version is on Amazon [https://a.co/
d/27KC3YN].
2. Buy the Working With Code in IntelliJ IDEA course [https://leanpub.com/c/workingwithcodeinintellijidea] from
Leanpub. This hands-on course covers everything from Part II of the book.
More information
• PDF and eBook from Leanpub [https://leanpub.com/gettingtoknowIntelliJIDEA]
68
15. Opening a project
Chapter Summary
• How can I open my existing code in IntelliJ IDEA?
• Does IntelliJ IDEA need special instructions if the project uses a build tool like Maven or Gradle?
69
Getting to Know IntelliJ IDEA (Community Edition)
Chapter Summary
• How do I run application code in IntelliJ IDEA?
• How can I stop applications or services that are running in IntelliJ IDEA?
70
17. Debugging your code
Chapter Summary
• How do I debug an application in IntelliJ IDEA?
This free community version does not include the contents of Parts II, III and IV of Getting to Know IntelliJ
IDEA. Read Part III in PDF and eBook [https://leanpub.com/gettingtoknowIntelliJIDEA] or Paperback and Kindle
[https://a.co/d/27KC3YN], or take the Developing Applications with IntelliJ IDEA course [https://leanpub.com/c/
developingapplicationswithintellijidea].
71
Getting to Know IntelliJ IDEA (Community Edition)
Chapter Summary
• How do I create a unit test for existing code?
This free community version does not include the contents of Parts II, III and IV of Getting to Know IntelliJ
IDEA. Read Part III in PDF and eBook [https://leanpub.com/gettingtoknowIntelliJIDEA] or Paperback and Kindle
[https://a.co/d/27KC3YN], or take the Developing Applications with IntelliJ IDEA course [https://leanpub.com/c/
developingapplicationswithintellijidea].
72
19. Combining testing and debugging
Chapter Summary
• How do I use the debugger to find a problem in my code without running the whole application?
This free community version does not include the contents of Parts II, III and IV of Getting to Know IntelliJ
IDEA. Read Part III in PDF and eBook [https://leanpub.com/gettingtoknowIntelliJIDEA] or Paperback and Kindle
[https://a.co/d/27KC3YN], or take the Developing Applications with IntelliJ IDEA course [https://leanpub.com/c/
developingapplicationswithintellijidea].
73
Getting to Know IntelliJ IDEA (Community Edition)
Chapter Summary
• What is a dependency?
74
21. Working with a build tool
Chapter Summary
• What does a build tool do?
75
Getting to Know IntelliJ IDEA (Community Edition)
Chapter Summary
• Why use version control?
76
Part IV: IntelliJ IDEA Essentials
In Part IV we’re pivoting our approach to this book. Whether you’re new to IntelliJ IDEA or are an
experienced user, we recognise there is plenty of functionality in the IDE which you might not have fully
explored.
In this section we are going to examine specific areas of IntelliJ IDEA and how the features support you in
your day-to-day tasks. Throughout this section, we’ll also summarise and cement the knowledge you’ve
learned so far.
To give you context on when and why you would use these IntelliJ IDEA features, we are introducing a new
element to these chapters; a "Frequently Asked Questions" section. These aim to answer your questions as
you dig into these chapters and explore more of what IntelliJ IDEA can do for you. The FAQ section will be
introduced with an "FAQ:" header, and you will see it in many of the upcoming chapters.
If you’ve been using IntelliJ IDEA for a while, you can use this section to learn more about specific parts of
the IDE, such as Run Configurations, using the terminal or what your '.idea' folder contains. The names of
the chapters should help you to pick out what you want to learn more about.
If you’re new to IntelliJ IDEA, we suggest you go through this section in order and see if you can put some
of your learnings into practice and to build on concepts we introduced earlier in this book.
1. Buy the full version of Getting to Know IntelliJ IDEA. The eBook and PDF versions are available on
Leanpub [https://leanpub.com/gettingtoknowIntelliJIDEA], and the paperback version is on Amazon [https://a.co/
d/27KC3YN].
2. Buy the Working With Code in IntelliJ IDEA course [https://leanpub.com/c/workingwithcodeinintellijidea] from
Leanpub. This hands-on course covers everything from Part II of the book.
More information
• PDF and eBook from Leanpub [https://leanpub.com/gettingtoknowIntelliJIDEA]
77
Getting to Know IntelliJ IDEA (Community Edition)
Chapter Summary
• Where do the warnings in the editor come from?
78
24. Refactoring your code
Chapter Summary
• Why might I want to refactor my code?
79
Getting to Know IntelliJ IDEA (Community Edition)
Chapter Summary
• Why are standardised code formatting settings helpful?
25.1. FAQ: When and how to format and arrange your code
How do I… format a file?
Where do I… tell IntelliJ IDEA to only format code that I’ve changed?
How do I… get IntelliJ IDEA to automatically fix my code when I format it?
Can I… see just the code style settings that affect a particular piece of code?
80
26. Benefiting from multiple clipboards
Chapter Summary
• What is Clipboard History?
• How can I paste several items I’ve copied into the editor at once?
How can I… paste several items I’ve copied into the editor at once?
This free community version does not include the contents of Parts II, III and IV of Getting to Know IntelliJ
IDEA. Read Part IV in PDF and eBook [https://leanpub.com/gettingtoknowIntelliJIDEA] or Paperback and Kindle
[https://a.co/d/27KC3YN].
81
Getting to Know IntelliJ IDEA (Community Edition)
Chapter Summary
• What is a Run Configuration and why do they matter?
• How can I share the settings for running an application with my team?
• How can I see what command IntelliJ IDEA uses to run my code?
Where does… IntelliJ IDEA look when my application loads an external file?
82
28. Diving into debugging
Chapter Summary
• Why are breakpoints important?
How do I…. rewind everything this method did and go back to where I was?
83
Getting to Know IntelliJ IDEA (Community Edition)
84
29. Expanding on testing
Chapter Summary
• How do I find which tests cover which code?
• What is the easiest way to navigate between the test and production code?
How can I… run tests with coverage for a single package or test?
How do I…. run a test without needing to open it in the editor first?
When should I… run my tests with Gradle instead of IntelliJ IDEA or vice-
versa?
85
Getting to Know IntelliJ IDEA (Community Edition)
Chapter Summary
• Why do I need to use a build tool for my projects?
86
31. Doing more with dependencies
Chapter Summary
• How do I see my dependencies?
87
Getting to Know IntelliJ IDEA (Community Edition)
Chapter Summary
• Why work with version control?
How can I… get IntelliJ IDEA to automatically check code before commit?
Commits
Commit details
88
32. Making version control work for you
89
Getting to Know IntelliJ IDEA (Community Edition)
Chapter Summary
• What is Local History?
• How can I use Local History to see files that have been deleted?
How can I… use Local History to see files that have been deleted?
This free community version does not include the contents of Parts II, III and IV of Getting to Know IntelliJ
IDEA. Read Part IV in PDF and eBook [https://leanpub.com/gettingtoknowIntelliJIDEA] or Paperback and Kindle
[https://a.co/d/27KC3YN].
90
34. Running commands in the terminal
Chapter Summary
• How can I run commands inside IntelliJ IDEA?
• What’s the difference between running a command in the terminal and running it in the IDE?
91
Getting to Know IntelliJ IDEA (Community Edition)
Chapter Summary
• Where can I see all the todo-style comments in your project code?
• How can I tell IntelliJ IDEA about a different type of todo comment?
• How can I configure the Commit tool window to either check or ignore new todo comments?
How do I… get IntelliJ IDEA to commit my changes even if there are TODO
comments in the code?
This free community version does not include the contents of Parts II, III and IV of Getting to Know IntelliJ
IDEA. Read Part IV in PDF and eBook [https://leanpub.com/gettingtoknowIntelliJIDEA] or Paperback and Kindle
[https://a.co/d/27KC3YN].
92
36. Pairing with code with me
Chapter Summary
• How can I securely collaborate with one or more people simultaneously in IntelliJ IDEA?
• How can I work with someone remotely, even if they don’t have IntelliJ IDEA installed?
Screen-sharing
93
Getting to Know IntelliJ IDEA (Community Edition)
Chapter Summary
• What are plugins in IntelliJ IDEA?
37.1. FAQ: How to view and change the plugins you work
with
How do I… view which plugins are installed?
94
38. Using AI Assistant
Chapter Summary
• What is AI Assistant?
This free community version does not include the contents of Parts II, III and IV of Getting to Know IntelliJ
IDEA. Read Part IV in PDF and eBook [https://leanpub.com/gettingtoknowIntelliJIDEA] or Paperback and Kindle
[https://a.co/d/27KC3YN].
95
Getting to Know IntelliJ IDEA (Community Edition)
Chapter Summary
• Is it true that IntelliJ IDEA itself runs on Java?
• Is IntelliJ IDEA using the same version of Java as the code that I’m running?
• How can I configure the JVM that IntelliJ IDEA uses for itself?
• Does changing IntelliJ IDEA’s JVM settings affect the version of Java I’m using to compile and run
my code?
• How can I tell the difference between JVM errors caused by IntelliJ IDEA and JVM errors caused
by my code?
96
40. Deciphering the Project Structure dialog
Chapter Summary
• What is the Project structure dialog and how can I open it?
97
Getting to Know IntelliJ IDEA (Community Edition)
Chapter Summary
• What’s the .idea folder for?
98
42. Changing IntelliJ IDEA settings
Chapter Summary
• How can I quickly change a setting?
99
Getting to Know IntelliJ IDEA (Community Edition)
Chapter Summary
• Something’s gone wrong; what can I try?
100
Appendix A: Top Tips that did not make it into the book
101
Getting to Know IntelliJ IDEA (Community Edition)
102