How to configure organizing of Java imports in Net

2020-07-08 08:01发布

问题:

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?

回答1:

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.