IntelliJ IDEA 2021.2 Help


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.

NetBeansIntelliJ IDEA
Global libraryGlobal library
Project libraryModule library
Project dependencyModule 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 Projects.

How do I change the JDK for my project?

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

  2. Under Platform Settings, select SDKs.

  3. Click the Add button, 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 SDKs.

How do I add a library to my project?

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

  2. Under Project Settings, select Libraries.

  3. Click the Add button, 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 (for example 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 (facets) and for example Jakarta Server Faces (JSF).

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 create run configurations yourself: in the main menu, select Run | Edit Configurations |. Click the Add button 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 Generate 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, press Ctrl+Alt+S.

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

For more information, see Settings/Preferences dialog and Project Structure dialog.

How do I start with VCS integration?

The most popular Version Control Systems including Git, Subversion, Mercurial, Perforce, 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 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 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 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.

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

You can.

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

  1. Open the Settings dialog Ctrl+Alt+S.

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

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

  4. Click OK.

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 Update 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. You can look for, download, install and update the plugins as well as enable and disable them.

For more information, see Plugins and Manage plugins.

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

  1. Open the Settings dialog 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, and so on). Have a look at Using IntelliJ IDEA for NetBeans Platform Development.

Configuring PHP development environment

What configuration is needed before start?

A lot of IntelliJ IDEA features are available without any configuration right after you launch it. Still, to take full advantage of running your PHP application, you need to configure a PHP interpreter and a server.

If you plan to launch the application locally, you need a PHP engine installed and registered in IntelliJ IDEA, as well as a Web server installed, configured, and integrated with IntelliJ IDEA. You can install these components separately or use an AMP package. For more details about initial environment configuration, refer to Configure PHP development environment.

If you are going to run and debug an application directly on a remote host, the only thing you need is register access to this host in IntelliJ IDEA to enable synchronization.

How do I start with deployment to a remote host?

If you've checked out your project from the remote host, the deployment server is already configured. Otherwise, you will need to get it configured (it can be FTP/SFTP/FTPS server or mounted/local folder) on the Deployment page of the Settings/Preferences dialog. The Remote host tool window is available on the right-hand side of the IntelliJ IDEA window, which can be handy for browsing through your remote server and performing various actions.

See Deploy your application for details.

How do I start debugging?

IntelliJ IDEA comes with support for both Xdebug and Zend Debugger for debugging and profiling. There is a zero-configuration debugging workflow available, which means that to start debugging you only need to:

  • Click Start Listening for PHP Debugging Connections the Start Listening for PHP Debug Connections button on the toolbar of the IDE.

  • Place a breakpoint in code by clicking in the editor gutter next to the line.

  • Start debugging in the browser using a plugin or browser bookmarklets.

Last modified: 23 March 2021