I won't want to have edit any working sets. I just want a way to, across all workspaces and projects, prevent .class files from ever showing in the Open Resource Dialog. Is there a way to do this?
-
4Answers are too old. I'm using eclipse neon and this worked for me: http://pujansrt.blogspot.com.tr/2013/04/hide-class-files-from-open-resource-and.html – kodmanyagha Dec 19 '17 at 14:45
-
In Eclipse Oxygen.2 the solutions shown here don't change behavior of the open-resource dialog for a Maven-imported project, with "derived" checked or unchecked on the target folder: the *.class files are still offered for selection. – chrisinmtown Mar 16 '18 at 13:03
9 Answers
One option is to filter derived resources. In the upper right corner of the 'Open Resource' dialog there is an arrow you can click to bring up a dropdown menu for filtering. Uncheck the 'Show Derived Resources' option, if it is checked.
If you still see '.class' files, they probably aren't being marked as derived. If they're by themselves in their own folder hierarchy you can fix this by right-clicking the root folder to edit folder properties, and check the 'Derived' checkbox. If they're mixed with your '.java' files...tough luck, you'll need to set the derived property on each '.class' file by hand.
As far as I can tell there's no way to mark class files as derived resources globally for the workspace, but I believe when you create a new Java project the 'bin' folder is marked as derived by default (if you use the default wizard settings)
Here are some screenshots from Eclipse Kepler. The first shows how to filter derived resources by unchecking 'Show Derived Resources' in the Open Resource dialog. The second shows how to set the 'Derived' property on a resource.

- 9,344
- 3
- 37
- 62
-
6I knew there was a way to do this. I already had this set up on a few projects, but when I imported a new one suddenly the .class files were showing up again. Just had to go through and mark all 'target' folders as derived. Perfect. – bergyman Apr 13 '10 at 20:15
-
Note that the 'Show Derived Resources' box appears to be missing in Indigo. Fortunately ensuring that the folder containing the .class files is set to derived (per instructions above) seems to correctly hide the unwanted files. – Matt Campbell Dec 06 '11 at 19:51
-
5I've opened the `.class` file in an attempt to find it's folder, so after marking it as Derived it still showed up. I had to right-click it and mark "remove from history" for it to go away. – mgarciaisaia Oct 29 '14 at 17:40
-
This works, but in a exact opposite manner for me. When I check 'Show Derived Resources' .class files are not shown in the List of searches. Wierd. Has any see this opposite behaviour? – mtk Feb 03 '15 at 09:52
-
-
1IntelliJ is better compare to eclipse in these ways, as a programmer I don't have to deal with setup stuff. I have been using intelliJ for almost 1 and half year, now I have to work on eclipse, believe me I see the difference. – Bilbo Baggins Mar 23 '17 at 05:47
-
5
-
Good answer, in my case it was the working set not scanned but your answer points me to the right direction. – рüффп Nov 08 '18 at 07:24
-
This does work for multi-module Maven projects, but you have to do this for every "instance" of the `target` directories, no matter which path is taken. Because Eclipse flattens all the Maven modules in its conception of the project (as you can see in the Package Explorer), you have to tag the same folder in multiple places. For instance, if you have nested modules `A/B/C` and you want to exclude the `A/B/C/target` directory, you’ll also have to manually exclude `B/C/target`, `C/target`. Yes, this is horrible. And which is why I'll pay for IntelliJ – huyz Aug 11 '23 at 18:53
- Right click on the project and select Properties
- Expand Resource and click on Resource Filters
- Click on Add Filter... to create a new filter
- On the dialog box that opens
- Select the Exclude all and Files radio buttons
- Under File and Folder Attributes enter
*.class
- Click OK
To exclude an entire directory hierarchy, e.g. the target
directory, select the Files and folders radio button and the All children (recursive) checkbox.
Edit
Exclude the following for a complete cleanup of Open Resource
dialog
- Files *.class
- Folder bin
- Folder build
- Folder target
Without excluding all 4 it does not work.

- 2,225
- 1
- 17
- 18

- 1,859
- 1
- 14
- 5
-
2@dips - Use `*.class` with an asterisk to match all class files. – David Harkness Feb 27 '13 at 18:53
-
8The recursive checkbox caught me out, it's a bit counter-intuitive for that behavior to be disabled by default. – Cheetah Sep 25 '13 at 15:38
-
2http://pujansrt.blogspot.com/2013/04/hide-class-files-from-open-resource-and.html – changeme Feb 10 '14 at 19:22
-
10This worked for me better than the accepted answer. Thank you very much – raja777m May 13 '14 at 18:33
-
2Can confirm this works, great catch! Main difference between this and my solution is that this solution also hides the .class files in all resources views, such as Package Explorer and Navigator. This may work better or worse for you depending on your needs and preferences. – Kevin K Oct 15 '14 at 13:53
-
2I tried this but found projects could not longer find classes from the projects they depend on. It didn't happen right away, but do a clean and you'll see it. It seems this resource filter prevents the class files from being exported. – NateS Dec 12 '14 at 07:25
-
-
nice explanation! solution worked. important part is "All children (recursive)" I was missing. – Abhishek Singh May 30 '17 at 06:55
-
@dips does not work since you have not added everything to the exclude.. for some reason only *.class does not work – Siddharth Jul 18 '18 at 05:31
-
And I should do this on each project of each Maven multimodule application that I have in the workspace? Really? – Pino Jul 09 '21 at 09:27
-
1No, this approach breaks things badly. It "worked" to hide the .class files, but nothing works right after that. Classes began failing to compile because they can't find dependencies! – deccles Nov 12 '21 at 15:20
-
I found if you have projects within projects you need to apply this to the parent projects as well. – Mark W Mar 28 '22 at 10:53
To change this behaviour and hide the “.class” files you need to do the following.
Find your class output folder in the “Project explorer” window. This is usually called bin or target for Maven projects
Right-click this folder and click Properties
Tick the Derived checkbox (leave it UNCHECKED) and click OK
.class files will now be hidden in future.
Source: http://ayubmalik.co.uk/2011/12/hide-class-files-when-opening-a-type-or-resource-in-eclipse-ide/

- 9,349
- 16
- 86
- 148

- 17,828
- 6
- 117
- 94
-
agree, this is the best solution. Excluding class files from resources causes class not found exceptions during runtime. – rveach Feb 17 '16 at 18:50
-
You also need to uncheck "Show Derived Resources" as listed in the top answer for this to work. Together, you two have a complete answer. – Noumenon May 25 '17 at 15:40
-
To see the class output folder in Oxygen, you may have to uncheck "Java output folders" in Project Manager Filters and Customizations (click the down arrow in the upper right). – Noumenon Dec 11 '17 at 22:17
-
-
The files in the target folder ARE derived. So you have to lie to Eclipse to make open-resource behave? – chrisinmtown Mar 16 '18 at 13:05
You can use Working sets
. From the same dropdown menu on Open Resource dialog select Select working set
. It opens up the working set dialogue where you can create working sets if you don't already have them.
When creating a new one, choose the type Resources
and select which folders in your workspace are consider as candidates for searching or for opening resources. I have included only src
and test
folders and usually pom.xml
's and other misc configuration files.
With the couple of large projects I'm working on it has a noticeable impact on search speed too.
-
1+1 thanks, using `Derived` solution is not doable for me, too many folders – marcinj Apr 22 '14 at 12:09
To solve this globally (on all projects), after pressing ctrl + shift + r, click on the top right corner of the window on the three dots button, then click on Select Working Set, tick both Java Main Source and Java Test Source and voila.

- 361
- 4
- 7
-
-
1there is a problem with this, files in the "Resource" folder will be excluded too. – Sam YC Nov 17 '22 at 05:46
Eclipse Luna - just go to the following link
http://help.eclipse.org/luna/index.jsp?topic=%2Forg.eclipse.platform.doc.user%2Ftasks%2Ftasks-48b.htm
OR
1. Create a working set (include all projects)
2. On "Package Explorer" panel click on "Filters" (in the same menu you just created the working set) and deselect "Inner class files" + click ok
That worked for me

- 1,120
- 9
- 7
Some time you are not able mark build or bin folder as Derived resource, because eclipse package explorer or project explorer does not show you build or bin folder in project view.
What you need to do, to show build folder in project view:
Go to
Project > Properties > Java Build Path > Source >
change default output folder to build1 Note: It will ask you to remove old folder and its content, Press No (to restore it later)Now build folder is visible on package explorer, go to folder properties and mark it as Derived
- Now change your default output folder back to build (to restore old setting)

- 3,212
- 8
- 41
- 53

- 253
- 2
- 8
Version 3.5 Open Resource dialog has a way turn "Show Derived Resources" on/off by a small dropdown menu at the top right hand corner. Turning it off will hide classes.
Or
you could type an expression on the "Select an item to open" text box such as : *.java

- 20,383
- 7
- 59
- 72
Showing or hiding files in the Project Explorer view You can choose to hide system files or generated class files in one of the navigation views. (System files are those that have only a file extension but no file name, for example .classpath.)
On the toolbar for the Project Explorer, click the Menu button Menu button to open the drop-down menu of display options. Select Customize View..,.
In the dialog box that opens, select the Filters tab and then select the checkboxes for the types of files that you want to hide. In addition, you can restrict the displayed files to a working set.
On the toolbar for the Project Explorer, click the Menu button Menu button to open the drop-down menu of display options.
Choose Select Working Set...
Select an existing working set from the list or create a new one by selecting NEw
check here

- 17,129
- 2
- 34
- 46