How do I hide .class files from the Open Resource dialog in Eclipse?
Data Structures & Algorithms practice on Codemia
Step through 300+ coding interview problems with animated visualisers that show the data structure changing as the code runs. The Blind 75 are free.
In Eclipse IDE, the Open Resource dialog is a quick and useful feature for navigating to files within a project. However, it can become cluttered with .class files, which are typically not intended to be directly edited by developers. This article provides a guide on how to hide .class files from appearing in the Open Resource dialog in Eclipse, enhancing your productivity by reducing visual clutter.
Understanding the Open Resource Dialog
The Open Resource dialog can be accessed through several methods:
Ctrl+Shift+Rshortcut on Windows/Linux orCmd+Shift+Ron macOS.- From the menu bar, navigate to
Navigate->Open Resource.
This dialog allows you to quickly locate and open files by typing part or all of the file name. Since .class files are generated bytecode files not meant for direct manipulation, hiding them can streamline your workflow.
Steps to Hide .class Files
Eclipse does not provide a direct GUI option to exclude specific file types from the Open Resource dialog, but you can use resource filters and exclusion settings:
1. Setting Up a Resource Filter
- Open the Package Explorer:
- Go to
Window->Show View->Package Explorer.
- Configure Filter:
- Right-click on the project in the Package Explorer.
- Select
Properties. - Navigate to
Resource->Resource Filters.
- Add a Filter:
- Click
Add Filter.... - Choose
Exclude Allas the filter type. - Set the Filter rule to
Name matches. - Enter
*.classin the text box to match all.classfiles.
- Apply the Filter:
- Click
OKto apply the filter. - Confirm by opening the Open Resource dialog and typing in a partial class name;
.classfiles should no longer appear.
2. Using the Navigator View
If .class files still appear in other views, you can switch to using the Navigator View, which respects more advanced filtering rules:
- Open the Navigator View:
- Go to
Window->Show View->Navigator.
- Add Filters:
- Use the
View Menu(a small downward arrow icon). - Select
Filters and Customization.... - Enable
*.classfrom the list of available filters.
3. Modifying .classpath for Exclusions
Eclipse uses a hidden .classpath file to manage build and resource settings:
- Open the
.classpathfile in your project root. - Add an exclusion node within the classpathentry tag for your source folders:
- Save and refresh the project to apply changes.
Additional Considerations
- Version Control: If your
.classpathand other filter settings are version-controlled, ensure to communicate these changes with the team. - Build Configuration: Excluding
.classfiles doesn't affect the build process since Eclipse auto-generates new.classfiles each time you compile.
Summary Table
| Method | Steps/Description | Affects |
| Resource Filter | Project properties -> Resource Filters -> Exclude all *.class | Package Explorer, Open Resource Dialog |
| Navigator View | Use Navigator view and apply filters | Navigator View, Open Resource Dialog |
| Classpath Exclusion | Edit .classpath to exclude .class files | May require project refresh, impacts build path but not build |
Implementing these methods not only helps in decluttering the Open Resource dialog but also fosters a cleaner development environment, preventing accidental edits on generated files. Considering the Eclipse environment is often used in large-scale projects, these changes can lead to substantial improvements in usability and efficiency.
Related reading
- How do i implement Headers Exchange in RabbitMQ using Java?
- How do I implement task prioritization using an ExecutorService in Java 5?
- How do I import the javax.servlet / jakarta.servlet API in my Eclipse project?
- How do I initialize a byte array in Java?
- How do I install Java on Mac OSX allowing version switching?
- How do I instantiate a Queue object in java?
- How do I invoke a Java method when given the method name as a string?
- How do I iterate through the files in a directory and it's sub-directories in Java?

OOD Fundamentals
Master object-oriented design from first principles, SOLID, design patterns, and classic interview problems with hands-on coding.
View the courseData Structures & Algorithms practice on Codemia
Step through 300+ coding interview problems with animated visualisers that show the data structure changing as the code runs. The Blind 75 are free.