Checkstyle : always receive File contains tab characters (this is the first instance)

step 1 In eclipse, Preference > Java > Code Style > Formatter. Edit the Active profile.(If you don't wish to edit the built-in profile , create a new profile). Under "Active profile:" there is a drop down dialogue box .. beside it, click "Edit..." which opens up the edit dialog box. Under the "Indention" tab, you'll find Tab Policy. Change the Tab Policy from Mixed to Space only & apply the changes.

step 2 Back to your Eclipse Perspective, navigate via the menu bar: Source > Format Element (not "Format") and save.

Run checkstyle you won't find "File Tab Character: File contains tab characters (this is the first instance)." warning anymore.

To visualize the difference by enabling whitespace character that you'll find in tool bar.


In eclipse, go to Preferences > General > Editors > Text Editors and check the box for "Insert spaces for tabs". Then it will indent with spaces instead of tabs.


another possibility is find and replace: - copy a tab - Got to Find and Replace Window find: paste the tab replace: type 4 whitespaces (or number of whitespaces a tab consists of) -> replaceAll