When I am using Eclipse, I want to know if I can use any tools so that I could hide some of my files so that they would not include in the compiling. There are many java files in the project containing the main function, so I just want to know if there are some tools which can hide some of the files.
Asked
Active
Viewed 192 times
1 Answers
0
- Right-click on the project in the package explorer
- Select "Build Path" -> "Configure Build Path...".
- On the "Source" tab on the right you see all source directories. Expand the relevant ones (if they aren't already expanded) and select either "Included" or "Excluded" and click the "Edit" button.
- Then you can either select sub-directories with "Add Multiple..." or add some patterns matching the files names you want with "Add..." in the respective sections.

Volker Kueffel
- 145
- 1
- 13
-
-
The source tab does not show all of your Java files. It shows all of the locations (directories) where Eclipse is looking for .java files to compile. Since these locations are considered "source locations", the default behavior is to include all .java files under those directories. But it lets you include or exclude a set of files or directories in the way I described above. Or are you saying your "Source" tab is completely empty? Then your setup is broken and Eclipse doesn't really do anything. – Volker Kueffel Apr 21 '16 at 16:41
-
Also, I'm not sure why you're mentioning the existence of main() methods in the context of this question. For the compiler a main() methods is just another method. There is no value excluding classes from the build path just because they have a main() method... – Volker Kueffel Apr 21 '16 at 18:19