Sunday, February 24, 2019

Intellij Idea - Migrating from Eclipse

Eclipse is yet another popular Java IDE. If you are a current user of Eclipse and want to migrate from it to IntelliJ, then this is a good starting point.
This chapter discusses how to import Eclipse projects in IntelliJ, its terminologies equivalent to Eclipse, popular shortcuts and frequently asked questions.

Import existing project

In this section, we will discuss how to import an existing project. Follow these steps to import the project −
  • Navigate to File → New → Project from Existing Sources.
  • Select your NetBeans project directory.
  • When the Import Project wizard opens, select the Create project from existing sources option.
  • Follow the on-screen instructions to continue.

IntelliJ vsEclipse terminology

The following table compares IntelliJ and NetBeans terminologies −
IntelliJEclipse
ProjectWorkspace
ModuleProject
FacetFacet
LibraryLibrary
SDKJRE
Path variableClasspath variable

Popular shortcuts

IntelliJ is a keyboard-centric IDE. It provides shortcuts for most of the actions. The following table lists a few popular shortcuts −
ActionShortcut
Run java programctrl+shift+F10
Organize importsctrl+alt+o
System.out.println()Type sout and Press ctrj+j
Delete current linectrl + y
Searchctrl + shift + f
Generate getter and setteralt + insert
Format codectrl + alt + l
Comment out codectrl + /
Go to linectrl + g
Go to declarationctrl + b
Renameshift+F6
Move linesctrl + shift + up/down

Debugger shortcuts

The following table lists down commonly used debugger shortcuts −
Debug actionShortcut
Debug a programShift + F9
Choose configuration and debugShift+Alt+F9
Step overF8
Step intoF7
Smart step intoShift + F7
Step outShift + F8
Force step overShift+Alt+F8
Force step intoShift+Alt+F7
Resume programF9
Evaluate expressionAlt+F8
Toggle breakpointsCtrl+F8
View breakpointsCtrl+Shift+F8

FAQsand Tips

In this section, we will see a few Frequently Answered Questions and tips. The FAQs and tips are as follows −

Use Eclipse Compiler

While Eclipse uses its own compiler, IntelliJ IDEA uses the javac compiler bundled with the project JDK. If you want to use the Eclipse compiler −
  • Navigate to File → Settings → Build, Execution, Deployment → Compiler → Java Compiler.
  • Select the required compiler from User compiler dropdown.
Eclipse Compiler

Eclipse Keymap

For Eclipse users who prefer not to learn new shortcuts, IntelliJ IDEA provides the Eclipse keymap that closely mimics its shortcuts −
  • Navigate to File → Settings → Keymap option.
  • Select Eclipse from Keymap dropdown.
Eclipse Keymap

Code formatting

To import your Eclipse formatter settings −
  • Navigate to File → Settings → Editor → Code Style → Java.
  • Select the Eclipse XML profile.
Eclipse Formatter Settings

Working with Build Tools

Like Eclipse, IntelliJ does not provide visual forms for editing Maven/Gradle configuration files.
Once you have imported/created your Maven/Gradle project, you are free to edit its pom.xml/build.gradle files directly in the text editor.

No comments:

Post a Comment

Popular Posts