Deleting .class Files

In most cases, the Clean and Clean All items on the Build menu will meet your needs for deleting .class files. However, if you want to delete .class files that have different names than their associated .java files, you must enable the Parse Class Files property before doing a Clean or Clean All.

To do a simple clean:

  1. In the Explorer window, select a folder or file.
  2. From the main window, choose Build and choose Clean or Build and choose Clean All.

    Build and choose Clean deletes the sourcename.class in the source's folder. If the compiler's Target property is set, this commands deletes sourcename.class in the appropriate destination folder. If you selected a folder, this command deletes all .class files within the folder. This command does not remove .class files within subfolders or .class files that no longer have a corresponding .java source.

    Build and choose Clean All is similar to Clean, but removes all .class files within a folder and its subfolders.

To clean .class files that are named differently from their .java files:

  1. From the main window, choose Tools and choose Options.
  2. In the Options window, expand IDE Configuration and expand System and expand Object Types.
  3. Select the Java Source Objects node.
  4. Set the Parse Class Files property to True and close the Options window.
  5. From the main window, choose Build and choose Clean or Build and choose Clean All.

    The IDE inspects every .class file without matching it to a Java source file.

Warning Be careful when enabling this property if you are working with JARs and libraries of classes without source files. Also, it is time consuming for the IDE to recognize .class files that are without a source file.
See also
Specifying a Target Directory for Class Files

Legal Notices