Sometimes, Java project needs to do code cleanup tasks in Netbeans.

The following tasks

  • Code format all files in a project
  • Removed Unused imports

How to code cleanup in Netbeans

  • Refactor Code with inspection Rules

    • Go to the Refactor Menu -> Select the Inspect and Transform option
    • It opens a Popup window to select the Inspect rule to inspect in a single file or a current project.
    • Select the Inspect dropdown value as Current Project.
    • Check one of the below options
      • Default settings
      • Single Inspection dropdown to select different inspection rules
  • Fixing Imports