Intellij Idea 简明教程

Intellij Idea - Migrating from NetBeans

NetBeans 是另一个流行的 Java IDE。如果你当前是 NetBeans 的用户,并且想要从 NetBeans 迁移到 IntelliJ,那么这里将是一个不错的起点。

NetBeans is another popular Java IDE. If you are a current user of NetBeans and want to migrate from it to IntelliJ then this will serve as a good starting point.

本章讨论了在 IntelliJ 中导入 NetBeans 项目及其与 NetBeans 等效的术语、流行的快捷键和常见问题。

This chapter discusses the importing of NetBeans projects in IntelliJ, its terminologies equivalent to NetBeans, popular shortcuts and frequently asked questions.

Import NetBeans project

在本节中,我们将学习如何导入 NetBeans 项目。按照以下步骤导入该项目:

In this section, we will learn how to import NetBeans project. Follow these steps to import the project −

  1. Navigate to File → New → Project from Existing Sources

  2. Select your NetBeans project directory.

  3. When the Import Project wizard opens, select the Create project from existing sources option.

  4. Follow the on-screen instructions to continue.

IntelliJ vsNetBeans terminology

下表比较了 IntelliJ 和 NetBeans 的术语:

The following table compares IntelliJ and NetBeans terminology −

IntelliJ

NetBeans

Module

Project

Global library

Global library

Module library

Project library

Module dependency

Project dependency

Module SDK

Project-specific SDK

IntelliJ 是一款以键盘为中心的 IDE。它为大多数操作提供了快捷键。下表列出一些重要的快捷键:

IntelliJ is a keyboard-centric IDE. It provides shortcuts for most of the actions. The following table lists a few important shortcuts −

Action

Shortcut

Run Java program

ctrl+shift+F10

Organize imports

ctrl+alt+o

System.out.println()

Type sout and press ctrl+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

Rename

shift+F6

Move lines

ctrl + shift + up/down

Debugger shortcuts

下表列出了几个重要的调试器快捷键:

The following table lists down a few important debugger shortcuts −

Debug action

Shortcut

Debug a program

Shift + F9

Choose configuration and debug

Shift+Alt+F9

Step over

F8

Step into

F7

Smart step into

Shift + F7

Step out

Shift + F8

Force step over

Shift+Alt+F8

Force step into

Shift+Alt+F7

Resume program

F9

Evaluate expression

Alt+F8

Toggle breakpoints

Ctrl+F8

View breakpoints

Ctrl+Shift+F8

FAQsand Tips

在本节中,我们将学习一些常见问题解答和提示。常见问题解答和提示如下:

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

Can I use the NetBeans key bindings in IntelliJ IDEA?

  1. Navigate to Files → Settings and select Keymap.

  2. Select NetBeans from the drop down box

drop down box

Is local history in IntelliJ IDEA different from that in NetBeans?

通常,IntelliJ IDEA 中的本地历史更详细。任何关于目录、文件、类、方法或字段或代码块的操作都会反映在你的本地历史中。本地历史还包括 VCS 操作。

Local history in IntelliJ IDEA, generally, is more detailed. Whatever you do with a directory, file, class, method or field, or a code block is reflected in your local history. The local history also includes VCS operations.

Can I enable ‘compile on save' in IntelliJ IDEA?

  1. Navigate to File → Settings → Build, Execution, Deployment → Compiler

  2. Select Build Project Automatically option.

  3. Click on the OK button.

build project automatically

Can I use NetBeans plugins in IntelliJ IDEA?

不行,你不能。

No, you cannot.

Is it possible to build NetBeans RCP applications with IntelliJ IDEA?

这是有可能的;但是,你无法获得与使用 NetBeans 所获得的相同类型支持(向导、菜单操作等)。要了解更多详细信息,请访问 this.

It is possible; however, you will not get the same kind of support that you get with NetBeans (wizards, menu actions, etc.). For more details, visit this.