IntelliJ IDEA 2018.2 Help

NetBeans

NetBeans users ask the following question about IntelliJ IDEA most frequently:

Working with projects

How do I open a NetBeans project in IntelliJ IDEA?

Use File | New | Project from Existing Sources and select your NetBeans project directory.

When the Import Project wizard opens, select the Create project from existing sources option and then follow the instructions of the wizard.

IntelliJ IDEA will add the necessary definition files (the .idea directory) to your project directory. The NetBeans .nbproject directory and build.xml will remain untouched, and you'll be able to use IntelliJ IDEA along with NetBeans.

During the import IntelliJ IDEA will fix missing libraries, add facets for different Web frameworks and create a run configuration.

If you are using Maven with NetBeans and you want to import a Maven project into IntelliJ IDEA, select File | Open and then select your project's pom.xml. You'll still need to configure a run configuration, however, all project dependencies will get resolved.

What's the difference between projects and modules?

IntelliJ IDEA creates a project for an entire code base and a module for each of its individual components. So, IntelliJ IDEA module is more like a NetBeans project.

The following table maps the most important NetBeans concepts to IntelliJ IDEA ones.

NetBeans

IntelliJ IDEA

Project

Module

Global library

Global library

Project library

Module library

Project dependency

Module dependency

Is there a directory-based project format in IntelliJ IDEA?

Yes, there is a .idea directory where project definition XML files are stored. For more information, see Working with projects.

How do I change the JDK for my project?

  1. Open the Project Structure dialog (File | Project Structure or Ctrl+Shift+Alt+S).

  2. Under Platform Settings, select SDKs.

  3. Clickicons general add svg, select JDK and specify the JDK installation directory.

  4. Click Apply.

  5. Under Project Settings, select Project.

  6. Under Project SDK, select the JDK from the list.

  7. Click OK.

For more information, see Working with SDKs.

How do I add a library to my project?

  1. Open the Project Structure dialog (File | Project Structure or Ctrl+Shift+Alt+S).

  2. Under Project Settings, select Libraries.

  3. Clickicons general add svg, select Java and specify the library location.

  4. Select the modules in which this library will be used.

  5. Click OK.

For more information, see Working with libraries.

How do I configure a Web framework for my project?

In IntelliJ IDEA Ultimate (there's no corresponding functionality in the Community Edition):

  1. Open the Project tool window (e.g. View | Tool Windows | Project).

  2. Right-click the necessary module and select Add Framework Support. (Framework support is enabled at a module level.)

  3. In the Add Frameworks Support dialog that opens, select the frameworks to be supported, specify the associated settings and click OK.

For more information, see Add Frameworks Support dialog and e.g.Enabling JSF support for an existing module.

The Run button is disabled. How do I run my application?

The Run button is disabled because there are no run configurations in your project.

If you have a Java class with a main() method, open the corresponding file in the editor, right-click the editing area and select Run '<FileName>.main()'. As a result, the necessary run configuration will be created automatically and then executed.

You can also create run configurations yourself: in the main menu, select Run | Edit Configurations |. Click icons general add svg to add a new configuration and choose how you want to run your application.

How do I generate an Ant build script for my project?

Select Build | Generate Ant Build. For more information, see Generating Ant Build File.

How can I open several projects in IntelliJ IDEA simultaneously?

It's possible to work with multiple projects simultaneously using IntelliJ IDEA. To achieve this, you only need to open a project, while another one is already opened, and choose Add to currently opened projects.

How do I close a project?

Select File | Close Project. You can also use File | Exit to close all open projects and quit IntelliJ IDEA.

Where is the Options dialog?

In IntelliJ IDEA, the Settings dialog is used for similar purposes. To open this dialog, pressCtrl+Alt+S.

There is also the Project Structure dialog (Ctrl+Shift+Alt+S) which lets you manage JDKs, libraries, module dependencies, etc.

For more information, see Settings / Preferences Dialog andProject Structure Dialog.

How do I start with VCS integration?

The most popular Version Control Systems including Git, Subversion, Mercurial, Perforce, CVS, TFS, and more are supported by IntelliJ IDEA. VCS integration for your project can be configured in on the Version Control page of the Settings /Preferences dialog. See Version control with IntelliJ IDEA fore details.

Working with the code editor

Can I use the NetBeans key bindings in IntelliJ IDEA?

Yes, you can.

  1. In the Settings/Preferences dialog (Ctrl+Alt+S), select Keymap under Appearance and Behavior.

  2. In the right-hand part of the dialog, next to Keymaps, select NetBeans 6.5 from the list.

How does code completion in IntelliJ IDEA work?

The code completion suggestion list appears automatically after you type one or two letters. To narrow down this list, use:

  • Ctrl+Space. The list is reduced to keywords and also the names of classes, methods and fields available in the current context. Note that the list changes when you press Ctrl+Space for the second or third time.

  • Ctrl+Shift+Space. Only the types appropriate for the current context are shown.

For more information, see Code completion.

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

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.

For more information, see Local History.

Are there any special code analysis features in IntelliJ IDEA?

IntelliJ IDEA can analyze dependencies, data flows and stack traces, find duplicates and evaluate code quality. Just have a look at the options in the Analyze menu.

Can I enable 'mark occurrences' in IntelliJ IDEA?

You can. The corresponding option in IntelliJ IDEA is called Highlight usages of element at caret. This option is enabled by default.

Just in case:

  1. Open the Settings dialog (e.g.Ctrl+Alt+S).

  2. In the Editor category, select General.

  3. In the right-hand part of the dialog, under Highlight on Caret Movement, select the Highlight usages of element at caret checkbox.

  4. Click OK.

See also,Highlighting Usages.

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

You can.

To enable automatic compilation on every save (or autosave), turn on the Make project automatically option in the Settings dialog:

  1. Open the Settings dialog (e.g.Ctrl+Alt+S).

  2. In the Build, Execution, Deployment category, select Compiler.

  3. In the right-hand part of the dialog, select the Make project automatically checkbox.

  4. Click OK.

Also note that by default, IntelliJ IDEA saves changed files automatically, so you don't need to use Ctrl+S as frequently as in other IDEs.

Can I enable 'deploy on save' in IntelliJ IDEA?

There is no such option in IntelliJ IDEA settings, however, you can get similar result by choosing an appropriate application update option in the corresponding run configuration.

For more information, see Updating Applications on Application Servers.

(The corresponding functionality is available only in IntelliJ IDEA Ultimate. The Community Edition doesn't provide integration with application servers.)

Using plugins

Can I use NetBeans plugins in IntelliJ IDEA?

Unfortunately not. However, a lot of functionality implemented as plugins for NetBeans is available in IntelliJ IDEA "out of the box". Besides, there's a lot of plugins for IntelliJ IDEA, so you can always find an IntelliJ IDEA plugin with the functionality similar to that of your favorite NetBeans plugin.

How do I find the plugin that I need?

All the functions related to working with plugins are on the Plugins page of the Settings dialog (Ctrl+Alt+S | Plugins). You can look for, download, install and update the plugins as well as enable and disable them.

For more information, see Plugins settings andManaging Plugins.

How do I install the plugin that I have available on my computer?

  1. Open the Settings dialog (e.g.Ctrl+Alt+S).

  2. In the left-hand pane, select Plugins.

  3. In the lower part of the Plugins page, click Install plugin from disk.

  4. In the dialog that opens, select the plugin file (normally, a JAR or ZIP).

  5. Click OK.

  6. If asked, restart IntelliJ IDEA.

I'd like to write a plugin for IntelliJ IDEA. Are there any instructions?

Yes, have a look at:

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

It is possible, however you won't get the same kind of support you would in the case of NetBeans (wizards, menu actions, etc.). Have a look at Using IntelliJ IDEA for NetBeans Platform Development.

Last modified: 20 November 2018