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 −
|Path variable||Classpath variable|
IntelliJ is a keyboard-centric IDE. It provides shortcuts for most of the actions. The following table lists a few popular shortcuts −
|Run java program||ctrl+shift+F10|
|System.out.println()||Type sout and Press ctrj+j|
|Delete current line||ctrl + y|
|Search||ctrl + shift + f|
|Generate getter and setter||alt + insert|
|Format code||ctrl + alt + l|
|Comment out code||ctrl + /|
|Go to line||ctrl + g|
|Go to declaration||ctrl + b|
|Move lines||ctrl + shift + up/down|
The following table lists down commonly used debugger shortcuts −
|Debug a program||Shift + F9|
|Choose configuration and debug||Shift+Alt+F9|
|Smart step into||Shift + F7|
|Step out||Shift + F8|
|Force step over||Shift+Alt+F8|
|Force step into||Shift+Alt+F7|
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.
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.
To import your Eclipse formatter settings −
Navigate to File → Settings → Editor → Code Style → Java.
Select the Eclipse XML profile.
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.