NetBeans FAQ

From IntelliJ-Wiki

Jump to: navigation, search

Items marked with * require Ultimate edition.


Project-related questions

How can I open a NetBeans project in IntelliJ IDEA?

Currently there is no "Import NetBeans project" functionality in IntelliJ IDEA. However in IntelliJ IDEA you can create a new project with existing sources. So in many cases moving the project to IDEA is not a complex operation, you can create a new project from existing sources using the "File | New Project" action. You can ask IDEA to use the same directory as your NetBeans project is using. IntelliJ IDEA then adds the .ipr file (IDEA project file) into this directory, as well as other necessary files into the project directory. The NetBeans .nbproject directory and build.xml remain untouched, so you can continue using IntelliJ IDEA along with NetBeans.

Some of the most common steps required during import include: fixing missing libraries, adding facets for different web frameworks and defining a Run Configuration. These steps are described in the FAQ entries below.

In case you use Maven with NetBeans and you want to import the Maven project in IDEA, you can simply use the "File | Open Project" action. Point IntelliJ IDEA to your project's pom.xml file and it will be able to open the project. You still need to configure the Run Configuration, however project dependencies should get resolved thanks to Maven's dependency resolution mechanisms.

What's the difference between projects and modules?

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

This table can help you see how NetBeans and IntelliJ IDEA concepts map to each other:

NetBeans IntelliJ IDEA
Project Module
Global library Global library
Project library Module library
Project dependency Module dependency

Is there a directory-based project format similar to NetBeans available for IntelliJ IDEA?

Yes, there is a new directory-based project format available in IDEA and can be used instead of the traditional .ipr project format. See project concept and this discussion for details.

How do I change the JDK for my project?

To configure a JDK for a project, go to "File | Project Structure" (or press Ctrl+Alt+Shift+S), under Platform Settings choose JDKs and specify JDK using the "plus" sign at the top of the window. After that, you can click Project and specify which of the JDK you have configured should be used in the current project. JDKs are configured on IDE level, so when you create another project, you won't need to add the same JDK again.

Refer to the "Configuring Project SDK" procedure for details.

How can I add a library to my project?

Use the "File | Project Structure" dialog (keyboard shortcut: Ctrl+Alt+Shift+S), under Project Settings choose Libraries, and click "plus" sign on the toolbar to add a new library. Specify the library name and then choose modules this library should be added to. Now you can choose classes or directories which you want to get added as jars as well as attach JavaDoc files. To add a jar file to your project choose the "Attach Classes" option.

Refer to the section Configuring Project and Global Libraries.

How do I configure a web framework for my project? *

In NetBeans you would add a web framework using the Project Properties dialog. In IntelliJ IDEA you need to use the "File | Project Structure" dialog (keyboard shortcut: Ctrl+Alt+Shift+S). IntelliJ IDEA uses a concept of facets which is more flexible than NetBeans, because in NetBeans you need to choose the type of the project you want to create upfront and then you can configure a web framework. In IntelliJ IDEA you just create a Java project and then add facets based on the needs for different frameworks in your project.

To add a facet to a module, go to the Modules node in the Project Structure, and choose the module you want to update tith a facet. Then click the top "plus" sign and choose the type of the facet you want to add (for example, EJB or Hibernate). Then you can configure the facet. For some of the web frameworks you need to download the framework jars to your disk and these are provided for your comfort on and can be downloaded directly using the dialog. However if you prefer to use your own version of jars, you can also point IntelliJ IDEA to the directory where your jars a located.

Tip: do not use the Facets node, unless you want to configure the default facet settings.

Refer to the sections under Managing Facets for details.

The Run button is disabled when I start a new project. How do I run my application?

The reason for your Run button to be disabled is that there is no Run configuration defined.

If you have a pure Java SE project, you can run a Java class simply by right clicking in the editor and choosing "Run File" or by pressing Ctrl+Shift+F10. Similarly you can debug the Java class from the context menu. This action creates a new Run configuration, so you can use the "Run" button from now on.

If your project requires deployment (e.g. a Java EE project), you need to configure a proper Run Configuration. Use the "Run | Edit Configurations" action or use the Run Configurations combobox in the IDE toolbar. Use the "plus" sign to add a new configuration and choose how you want to deploy your application. Note that "local" servers are managed by IntelliJ IDEA and "remote" servers are managed by yourself, which means you need to start and stop the server yourself outside of the IDE. If you can't find the server you are using as one of the options make sure to check available plug-ins for IntelliJ IDEA (check the "Where can I find useful plug-ins?" FAQ entry below).

Where can I find the "Close project" action?

NetBeans users may be used to closing projects from the Projects window. This can't work in IntelliJ IDEA because what you see in the window are modules, not projects. Each global window with IntelliJ IDEA instance represents a single project. So if you want to close the opened project, you need to run the global Close Project action which is located in the main menu as "File | Close Project".

Refer to the section Opening, Reopening and Closing Projects.

Where can I find the "Options" dialog?

The options dialog is called Settings dialog in IntelliJ IDEA, and is invoked by "File | Settings" command on the main menu. You can configure global IntelliJ IDEA settings here as well as many project-related settings. Note that you can use the search functionality to quickly find an option — this is very practical because there are many options to configure.

Refer to the sections Configuring IDE Settings and Configuring Project Settings for details.

Also note that some project-related settings are located in a different dialog — in the "File | Project Structure" dialog, which lets you configure options such as project JDK, Java version, libraries, facets and so on.

IntelliJ IDEA doesn't use Ant by default. Can I easily generate an Ant build script for my project?

Yes, there is a feature that can generate an Ant build script — try running "Build | Generate Ant Build".

Please refer to Ant section for the details of Ant support.

Editor-related questions

Can I use NetBeans keybindings in IntelliJ IDEA?

Yes! Since version 8.1.3 there is a NetBeans keymap available. To activate it, go to "File | Settings", then "IDE Settings | Keymap" and choose NetBeans 6.5.

Please refer to Configuring Keyboard Shortcuts section for details.

Note that this keymap is very new so in case you encounter any issues please file an issue into YouTrack.

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

To enable automatic compilation on every save (or autosave), turn on the Make project automatically option on the Compiler page in the Settings / Preferences dialog (File | Settings | Compiler on Windows or Linux, or IntelliJ IDEA | Preferences | Compiler on Mac OS X).

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?

Unfortunately IntelliJ IDEA doesn't not have such feature at this moment. However note, that you can speed up your deployment by checking the "Build on frame deactivation" checkbox in the Run Configurations dialog.

Can I enable "mark occurrences" in IntelliJ IDEA?

Yes! You can enable this features using "File | Settings", then "IDE Settings | Editor" and in this window select the check box "Highlight usages of element at caret".

Refer to the section Highlighting Usages for details.

How does code completion in IntelliJ IDEA differ from NetBeans?

In IntelliJ IDEA you have three types of code completion (basic, smart type, and class name), and numerous other techniques, which help you pick what's best for the code you're working with.

For example, when you just need to quickly complete an obvious statement, you can press Ctrl+Space and it's done. It's called the Basic Completion. It also comes in handy when you want to look at the complete list of available choices in the current context, or need to complete a keyword.

If you need more precision and don't want to scroll through an endless list of selections, use Ctrl+Shift+Space to narrow the selection down by the expression type. Smart Completion that is invoked this way, will filter the list for you, letting you get what you need quicker. Moreover, if you press it once again it will even show you the symbols that can be reached through a chained method call.

Finally, the Class Names Completion (Ctrl+Alt+Space) lets you quickly complete a class name, and insert an import statement if it's not referenced yet.

Refer to Auto-Completing Code for details.

Is there a difference in how the local history feature is implemented?

Local history in IntelliJ IDEA tracks user actions, so it is more granular and you can see which activity you performed in the editor including VCS operations. So you get more details than in NetBeans where you can only see text-based changes to the individual files. Please refer to local history concept for details.

Are there any special code analysis features in IntelliJ IDEA?

Absolutely, IntelliJ IDEA has very advanced code analysis features many of which you cannot find in NetBeans.

Make sure to check out the "Analyze" top menu for different possibilities of code analysis including quality analysis, dependency analysis, detection of duplicates and stacktrace analysis.

Refer to the following resources:

- Analysing Applications

- Static Code Analysis

Plugin-related questions

Learn more about IntelliJ IDEA plugins here.

Can I use NetBeans plugins in IntelliJ IDEA?

Unfortunately no, NetBeans APIs are different from IntelliJ IDEA's APIs, so you can't use .nbms in IDEA. However a lot of functionality that is available for NetBeans as plug-ins is already available out of the box in IntelliJ IDEA. There is also a very healthy community of plug-in writers for IntelliJ IDEA, so check out available plug-ins, they may provide similar functionality as your favorite NetBeans plugins.

Where can I find useful plugins ?

You can install plugins right from the IDE using the "File | Settings" dialog. In the "IDE Settings" section choose "Plugins" and then click the "Available" tab to see which plugins are available. You can also search the online plugin repository, which contains many useful plugins.

Please refer to the section Managing Plugins for details.

How do I install a plugin from my disk?

Plugins are usually provided as zip files or jar files. Close IntelliJ IDEA, extract the zip file or copy the jar into one of IntelliJ IDEA's plugin folders — either into <user-home>/.IntelliJIdeaXX/config/plugins or into <intellij-idea-install>/plugins. Restart IntelliJ IDEA and the plug-in will get loaded.

Where can I find documentation for writing plugins for IntelliJ IDEA?

Check out the resources available in the documentation area (Plugin Development Guidelines and IntelliJ IDEA Plugins. For specific questions you can use the OpenAPI forum (also available as a newsgroup).

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

Yes it is possible, however you will not get the same kind of support you would get from NetBeans (wizards, menu actions, etc.). Currently there is no tutorial about this topic but you can check out the Eclipse RCP tutorial, which explains concepts related to building RCP applications with IntelliJ IDEA. Although this tutorial is targeted to Eclipse RCP developers you can still learn about the necessary steps if you want to build NetBeans platform based applications in IDEA. Also look at this article on DZone about building NetBeans-platform based applications with IntelliJ IDEA.

Is there a platform similar to NetBeans platform available from JetBrains?

Internally JetBrains uses IntelliJ IDEA platform for its products — for example, RubyMine, PhpStorm, WebStorm, PyCharm, and MPS are built using the same sources as IntelliJ IDEA. However, it is currently not possible to use the IntelliJ IDEA platform to build your own applications.

Feature-related questions

What are the typical features where IntelliJ IDEA excels over NetBeans?

You can check out the "Why IntelliJ IDEA" article. IntelliJ IDEA has better refactorings capabilities than NetBeans. It also has more code quality-related features, such as intentions and code analysis features. IntelliJ IDEA Ultimate edition provides very good integration with many web frameworks, many of which have only basic support in NetBeans. Many languages are supported including new languages such as Groovy, Scala and Clojure, whose support in NetBeans is not as good. We also believe IntelliJ IDEA has better understanding of code and thus offers better productivity than NetBeans, due to its code-centric approach to development.

Are there features from NetBeans that are not present in IntelliJ IDEA?

IntelliJ IDEA does not currently provide an RCP platform. Profiler is not available out of the box, although it can be installed as a plug-in. JavaFX support is still basic in IntelliJ IDEA and C/C++ is not supported. There are fewer visual designers in IntelliJ IDEA than in NetBeans, although visual approach seems to be less important for professional developers due to various limitations of visual designers. Other features should be on par or have better support in IntelliJ IDEA according to our current knowledge.

Where can I get a profiler for IntelliJ IDEA?

There is no built-in profiler available for IntelliJ IDEA however we can recommend JProfiler which nicely integrates into IntelliJ IDEA.

Is there a similar functionality in IntelliJ IDEA as integration with Hudson?

JetBrains provides its own continuous integration product called TeamCity. We recommend to check out this product, also because it can be used for free for up to 30 build configurations with up to 3 build agents and provides some features that are missing in Hudson, such as pre-tested commits or immediate test result delivery.

I do not see a "JSF" file option, how do I create a JSF file in IntelliJ IDEA? *

First, add the JSF facet to your project. Refer to the section How do I configure a web framework for my project for details. Then simply create a JSP. Add the <f:view></fview> tags into your source code. You should see an intention that tells you you can add the import for the tag library. Run this intention using Alt-Enter. Similarly you can add other tags such as <h:outputText/>; and fix tag library imports.

How do I configure a JDBC database connection in IntelliJ IDEA?*

You can use the Data Sources tool window to define a JDBC database connection. The Data Sources tool window should be docked on the right side of the IDE, you can also open it using the top menu in "Window | Tool Windows | Data Sources". There are two different types of data sources available:

- JDBC data source which connects to the database.

- SQL data source which uses SQL DDL files for data definition (the advantage of this data source approach is that you can refactor the DDL together with your source code, however you are not communicating with the database directly).

Is there a visual designer for Swing similar to project Matisse?

Yes, IntelliJ IDEA has a built-in visual designer. Read more about the designer here and here. Although it doesn't support the GroupLayout layout manager used by Matisse, it also has many advanced features including refactoring, inspections, data binding and so on. There is also a JFormDesigner plugin for IntelliJ IDEA.

Is there a visual designer for JSF or Java ME? *

IntelliJ IDEA provides a great JSF code editor, which is more useful than a visual designer with various limitations. As for Java ME, it is supported out of the box (code-centric approach). Android support is available since IntelliJ IDEA 9 as well.

Personal tools