Configuring the IDE

One of the main strengths of the IDE is its versatile configurability. You can customize your working environment to fit your needs and personal development style. Having all of these options can, however, make it difficult to find the exact setting you are looking for.

In this section you will learn about the following:

To configure project-level settings such as a project's properties and JDK level, see Setting Up Projects.

Setting IDE Default Settings

The main tool for configuring default settings in the IDE is the Options window. You can open the Options window by choosing Tools > Options from the main menu.

IDE settings are grouped into categories in the Options window. When you open the Options window, you are in the Basic view by default. In Basic view, you click on a category in the left pane to display the settings options in the right pane. Depending on the category, you can click on the tabs or nodes in the right pane to see additional settings.

Options dialog box

To access more advanced settings, click the Advanced Options button at the bottom of the Options window. In this Advanced view, you select a node in the left pane of the window and the properties you can modify are displayed in the right pane. An ellipsis (...) button next to the property indicates that a property editor is available for a property.

Configuring General Java Settings

The first thing you should do to configure the IDE is make sure it is using the correct Java Standard Development Kit (JDK) version. The JDK in which the IDE runs is important because it is automatically used as the platform against which all of your sources are compiled and executed. See Setting the Target JDK in a Project for details.

To see which JDK your IDE is running on, choose Help > About and click the Detail tab. The location of the JDK is listed as Java Home. By default, the IDE uses the JDK that is specified in your system's registry as the most recent. If you only have one version of the JDK installed on your computer, this is not a problem. If you have multiple JDK versions installed, it can be a good idea to configure a startup switch to explicitly specify which JDK the IDE should use. You can do so by using the --jdkhome JDK folder switch (for example, --jdkhome c:\jdk1.5.0_04 ) on the command line, or by specifying the JDK location in your netbeans.conf file.

Another important tool in defining Java settings is the Java Sources node in the Advanced view in the Options window. The Java Sources node, which is located under the Editing node, contains general settings for how the IDE handles Java source files. The following settings are available in the Java Sources node:

Setting Java sources properties in the Options dialog box

Working With File Types

The IDE recognizes the standard file extensions for most types of files. For example, it knows that files with the extensions .htm , .html , and .shtml should all be treated as HTML files. Many file types, like XML, can have nonstandard file extensions that the IDE does not recognize.

If you want to treat all files with a certain file extension as a certain type of file, go to the Options window, click the Advanced button and expand IDE Configuration > System > Object Types. The Object Types node contains all of the file types that the IDE is currently configured to work with. You can use the Extensions and MIME Types property to specify which file extensions should be treated as a given type of file.

For example, JavaHelp ΤΜ map files are XML documents that have a .jhm extension. You can treat all JavaHelp map files as XML documents by adding .jhm to the list of Extensions and MIME Types for the XML Object object type.

Configuring Ant Settings

You can configure additional Ant settings in the Options window by opening the Options window, selecting the Miscellaneous category in the left pane and clicking the Ant node in the right pane. You can specify the following properties:

Enabling and Disabling IDE Functionality

NetBeans IDE is a fully modular IDE, meaning that its functionality is provided by modules that plug into the core NetBeans infrastructure. If you do not use the functionality provided by certain modules, you can turn those modules off. Turning off unused modules helps improve your IDE's startup time and performance. You can also add functionality to your IDE by downloading new modules from the Update Center.

Disabling Modules

The Module Manager is the most convenient tool for enabling and disabling modules. Disabling a module only causes the IDE to ignore the module. The module is not deleted and it can be enabled again at any time.

To open the Module Manager, choose Tools > Module Manager. The Module Manager displays all the modules registered with the IDE and if they are registered. You can enable or disable a module by selecting or deselecting the active checkbox for that module. You can uninstall a module by selecting the module in the list and clicking Uninstall. To check if new modules are available from the Update Center, click Update.

Module Manager

The Module Manager groups related modules into module groups. For example, the Java group contains all of the modules that deal with Java development. You can disable all modules in a module group by unchecking the checkbox in its Active column, or expand the module group node to disable individual modules. When only certain modules in a module group are disabled, the Active column for the group is checked [ boolean ]. When you are finished, click Close to activate your changes.

Certain modules depend on other modules to function properly. Disabling or enabling one of these modules may require you to also disable or enable the modules upon which it depends. If this is the case, the IDE displays a dialog that tells you which modules will also be disabled or enabled and asks for your confirmation.

Installing New Modules from the Update Center

You can add functionality to your IDE by downloading new modules from the NetBeans Update Center. To connect to the Update Center, choose Tools > Update Center from the main window. In the Update Center wizard, select the Update Centers that you want to connect to. Make sure that your proxy information is properly configured and that you can connect to the Internet. You can edit your proxy configuration using the Proxy Configuration button on the wizard page. Click Next when you are ready to proceed.

The second page of the wizard shows you all of the modules that are available on the Update Centers. The wizard only displays modules that are not already installed in your IDE or newer versions of modules that are already installed. Select any module to see detailed information about the module, including a description, the version number of the module on the Update Center, and the version number of the module already installed on your system.

To download a module for installation, select the module in the left pane and click the Add button. When you are ready to proceed, click the Next button to view the modules' certificates and install the modules.

Boosting NetBeans Performance

You can monitor your IDE's performance with the Memory toolbar. To view the Memory toolbar, right-click anywhere in the toolbar area and select Memory in the pop-up menu. The Memory toolbar has a slide that shows you how much of the IDE's memory is currently being used and how close it is to automatically performing garbage collection. You can manually initiate garbage collection by clicking the Memory toolbar.

You can boost NetBeans performance by adjusting the JVM switches with which you start the IDE.

Configuring IDE Startup Switches

You can use Java startup switches to configure the IDE. You can add startup switches to the IDE on the command line or by entering them in a special file called netbeans.conf , which is located in the etc folder in the NetBeans installation folder. You can enter IDE-specific startup switches and pass arguments directly to the JVM in which the IDE runs.

For example, to set the -Xmx (maximum heap size) for the JVM in which the IDE runs, either add the line -J-Xmx64m to your netbeans.conf file or launch the IDE from the command line by typing the following on UNIX systems:

./netbeans.sh -J-Xmx64m 

or, on Windows systems, the following:

netbeans.exe -J-Xmx64m 

The netbeans.conf file can have the various JVM switches separated either by spaces or on separate lines. Note that the JVM does not start when switches are passed that it does not understand. When this error occurs, the JVM returns a message pointing out the switch that caused the problem, as with the following example:

java -foo
Unrecognized option: -foo
Could not create the Java virtual machine.

The following table lists the available startup switches.

Startup Switch

Description

-h
--help

Print descriptions of common startup parameters.

--cp:p additional_classpath

Prefix the specified classpath to the IDE's classpath.

--cp:a additional_classpath

Append the specified classpath to the IDE's classpath.

--fontsize size

Set the font size, expressed in points, in the IDE's user interface. If this option is not used, the font size is 11 points.

--jdkhome jdk_home_dir

Use the specified version of the Java? 2 SDK instead of the default SDK. By default on Microsoft? Windows systems, the loader looks into the registry and uses the latest SDK available.

You should back up your user directory before you upgrade the SDK that the IDE uses. If you later need to revert to the previous JDK, switch to the backed up user directory to ensure that you do not lose any settings.

To switch the IDE's user directory, use the -userdir switch detailed below.

-Jjvm_flag

Pass the specified flag directly to the JVM.

-J-Dsun.java2d.noddraw=true

Prevent the use of DirectX for rendering. This switch might prevent problems that occur on some Microsoft Windows systems with faulty graphics cards.

-J-Dnetbeans.debugger.jpda.transport=dt_shmem userdir

Force the IDE to use the shared memory connection when starting a debugging session with the Debug > Start command. This parameter has no effect when you attach the debugger to an already running process.

--laf UI_class_name

Selects the given class as the IDE's look and feel. The following are two examples of look and feel classes:

  • com.sun.java.swing.plaf.motif.MotifLookAndFeel
  • javax.swing.plaf.metal.MetalLookAndFeel

--locale language[:country[:variant]]

Use the specified locale.

--open file

Open the file in the Source Editor.

--open file:line number

Open the file in the Source Editor at the specified line.

--userdir userdir

Explicitly specify the userdir , which is the location in which user settings are stored.

You can determine the current user directory in the About dialog box. Choose Help > About and then click the Detail Tab. The tab lists the location of the User Dir as well as other product details.

Tuning JVM Switches for Performance

JVMs offer a variety of standard and non-standard switches that tune memory allocation and garbage collection behavior. Some of these settings can benefit the performance of the IDE.

Note that -X and especially -XX JVM switches are officially "unsupported" because they are often JVM or JVM-vendor specific. The switches discussed in this section are available for Sun Microsystems J2SE 1.4.2 and J2SE 1.5. Users of other JVM implementations may need to remove these switches in order to run the IDE.

The following settings should produce better-than-factory setting performance on most systems. With the exception of setting the "permanent area" size, these switches have been the defaults for the IDE for some time, and should already be present in your netbeans.conf file.

Listed below are some additional JVM switches which have either anecdotally or measurably impacted NetBeans performance on some, not all, systems. Your mileage may vary, but they may be worth a try.


Previous - TOC - Next


Copyright and Trademark Notice