Dmytro Kryvenko
Dmytro Kryvenko

Reputation: 343

How to configure organizing of Java imports in Netbeans

Currently Netbeans (I'm using version 7.3.1) has an in-built ability to organize imports in Java files via menu Source » Organize Imports. But I need to change the default order of imports. (For example, when working in a shared environment, software developers must use the same import settings.)

Is there any way to do so?

Upvotes: 8

Views: 7620

Answers (1)

Gábor Csikós
Gábor Csikós

Reputation: 2927

Try:

  1. Click Tools → Options.
  2. Click the Editor icon.
  3. Click the Formatting tab.
  4. Set Language to: Java.
  5. Set Category to: Imports.
  6. Change the settings as desired.
  7. Click OK or Apply to save the changes.

To organize the imports on save:

  1. Click Tools → Options.
  2. Click the Editor icon.
  3. Click the On Save tab.
  4. Check Remove Unused Imports.
  5. Check Organize Imports.
  6. Click OK or Apply to save the changes.

Upvotes: 16

Related Questions