IDEA sums up the code of sharpening the knife

If you want to be good at your work, you must first make use of your tools. At present, countless Java programmers have replaced Eclipse in the stone age with InteliJ IDEA, a modern intelligent development tool. It's a great time to write code (joke, each has its own advantages, depending on personal habits)

But every time I see other people using IDEA, I will find that, wow, I can still operate like this, and every time the registration code fails, I regret that I am using pirated software and "why don't I make more money to support the genuine", and then I look for the registration code everywhere, so here comes this article ~ ~... Installation and writing of hello world deployment to the server are not recorded,

Click like + collect to learn the series, articles are included in GitHub JavaEgg , N-line Internet development necessary skill weapon spectrum

InteliJ IDEA introduction

IDEA, the full name of IntelliJ IDEA, is the integrated development environment of Java language. IDEA is recognized as one of the best java development tools in the industry, especially in the intelligent code assistant, code automatic prompt, refactoring, J2EE support, Ant, JUnit, CVS integration, code review, innovative GUI design and other functions can be said to be extraordinary.

IDEA is a product of JetBrains. There are other products under the company, such as WebStorm, DataGrip, GoLand


  • Strong integration capability. For example: Git, Maven, Spring, etc
  • Prompt function is fast and convenient
  • Wide range of prompt functions
  • Easy to use shortcut key and code template private static final psf
  • Precision search (IDEA will index your source code)
  • Do not need frequent Ctrl+S (auto save)
  • Built in decompiler, easy to view source code

In Eclipse, we have the concepts of workspace and Project. In IDEA, we only have the concepts of Project and Module. Workspace in Eclipse is equivalent to Project in IDEA, and Project in Eclipse is equivalent to Module in IDEA

Terminology comparison between IDEA and Eclipse

Eclipse IntelliJ IDEA
Workspace Project
Project Module
Facet Facet
Library Library
Classpath variable Path variable


Live Templates

Its principle is to configure some common code abbreviations. When inputting abbreviations, you can see the predefined fixed mode code, which greatly improves the development efficiency and also increases the personalization. The simplest example is System.out.println() when you type sout in Java;

Editor – General – Postfix Completion view the existing template (not modifiable)

Editor - Live Templates view or customize templates (you can add method comments, class comments)

 * @description:
 * @param $param$
 * @return $return$
 * @date $time$ $date$

Class comments are generally set through File Setting Editor Live Templates File and Code Templates

breakpoint debugging

Are bug s written every day, so this function must be used

Configure common debugging properties and behaviors: Settings/Preferences | Build, Execution, Deployment | Debugger

1. Breakpoint type

There are four types of breakpoints:

  1. Line Breakpoints: the most frequently used method, which can be set on any executable code line
  2. Method Breakpoints: suspend a program when entering or exiting a specified method or one of its implementations, allowing you to check the entry / exit conditions of a method
  3. Field Watchpoints: suspends a program when a specified field is read or written. It should be noted that only writing will stop by default. To stop reading, you need to right-click the breakpoint and tick the Field access of the Watch
  4. Exception Breakpoints: suspends a program when Throwable or its subclasses are thrown. You can add specific types of exceptions in Java Exception Breakpoints in Run View Breakpoints. In this way, the program will stop as soon as the exception occurs

2. Set breakpoint

Left click on the line number bar (Shortcut: Ctrl+F8)

Set exception breakpoint

Click View Breakpoints on the left side of the Debug tool window Or the shortcut key Ctrl+Shift+F8 can be used to create a new exception detection or to detect all the exceptions (Any Exception), so as long as the program has corresponding exceptions, it will be suspended

Conditional breakpoint

Sometimes when we are processing data circularly, we may only care about the data of a certain condition, so we can right-click the breakpoint position and set the breakpoint condition. (below, suspend the program when i==6)

Multithreaded breakpoint

When debugging multithreaded code, it can only be debugged on a serial basis, because when IDEA is in Debug, the default blocking level is ALL, which blocks other threads, and it will only take other threads when the current debugging thread is finished. If it is a line of a lambda expression, as shown in the following figure, you can choose the breakpoint type.

You can select Thread (right-click breakpoints) in View Breakpoints, so that Frames can switch threads for debug ging.

3. Step by step procedures

  • Step over -- step over. If the current line breakpoint is a method, it will not enter the current method body
  • step into -- step in. If the current line breakpoint is a method, it will enter the current method body, which is generally used to enter the user-defined method and will not enter the official class library
  • force step into Shift+Alt+F7 -- force step into any method, which can be used to enter the official class library when viewing the underlying source code
  • Step out shift + F8 -- step out, exit from the stepped in method to the method call
  • Drop frame -- back to the previous step
  • Run to cursor Alt + F9 -- run to the cursor, you can locate the cursor to the line you need to view, and then use this function, the code will run to the cursor line without breaking the point

Breakpoint has many functions. It can analyze the heap object in JVM, Stream operation in Java8, and leave a transport gate... TODO

Some big guy summed up: Using Debug in Intellij IDEA

Official course:

Configure Tomcat remote debugging

Sometimes there are problems caused by server differences, which are not easy to troubleshoot. At this time, you want to debug the code on the server remotely.

① Configure tomcat, and add a section of settings at the top of under tomcat/bin

-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=9527

② IDEA settings

③ After launching remote tomcat on IDEA, you can debug it

There is another way to copy the contents of Startup/Connection to Java? Opts without trying


Bookmarks can easily record the call link of the code when looking at the source code or big guy code.

There are two kinds of bookmarks: anonymous bookmarks (can be numerous) and tag bookmarks (bookmarks with number or letter mnemonics)

Operation Bookmarks: Navigate | Bookmarks can create anonymous bookmark Toggle Bookmark. Create a technical bookmark Toggle Bookmark With Mnemonic and view the tag Show Bookmarks

Plug-in unit

  • Lombok -- develop artifact to simplify your entity class

  • Maven Helper -- a good helper for displaying maven's dependency tree and handling conflicts

  • . ignore -- ignore files that do not need to be submitted

  • Findbugs idea - Code Review

  • Alibaba Java Coding Guidelines -- Alibaba's development and design specifications

  • Alibaba Cloud Toolkit helps developers develop, test, diagnose and deploy applications more efficiently. Through plug-ins, local applications can be deployed to any server or cloud with one click, and there are also built-in tools such as Arthas diagnosis, Dubbo tool, Terminal terminal, file upload, function calculation and MySQL executor

  • Easy Code -- a code generation plug-in supporting custom templates

  • restful toolkit -- restful service development assistant tool set (Amway, which can be viewed directly in RestServices on the right, restful interface of all projects, and can also be searched globally through Ctrl)

IDEA theme and plug-in leaderboard:


For personal study only~~

  1. Download the patch file jetbrains-agent.jar and place it in the bin directory of the Idea installation directory,

  2. Free trial, enter IDEA, click * * Help - Edit Custom VM Options * * in the top menu bar, add - javaagent in idea.exw.vmoptionos file: D: \ program files \ JetBrains \ IntelliJ IDEA 2019.2.4 \ bin \ jetbrains-agent.jar (change to your jar package directory), and restart

  3. After restarting IDEA, open * * Help Register * * and fill in the License Server, http://jetbrains-license-server In case of failure, enter the registration code below

  1. Help - About, done

Reference resources

IntelliJ IDEA 2019.3 Official Guide

Activation of idea2019

You may be able to improve your skills after this cup of Java

Keywords: Programming Java Eclipse IntelliJ IDEA Tomcat

Added by glansing on Tue, 21 Jan 2020 06:20:21 +0200