Checkstyle is an open-source development tool to help programmers write Java code that adheres to a coding standard. It automates the process of checking Java code. It is ideal for projects that want to enforce a coding standard. Checkstyle is a code checker and not a code fixer. If you need a code fixer you could use Jalopy.

Checkstyle is highly configurable and can be made to support almost any coding standard. Configuration files are supplied to support well known coding standards such as the Sun Code Conventions for the Java Programming Language.

Checkstyle is released under the GNU Lesser General Public License (LGPL).

Checkstyle can check for:
  • Javadoc Comments
  • Naming Conventions
  • Headers
  • Imports
  • Size Violations
  • Whitespace
  • Modifiers
  • Blocks
  • Miscellaneous Checks (including some useful checks like unnecessary System.out and printstackTrace)
More information about Checkstyle can be found at:

Plug-ins are written to integrate Checkstyle with an IDE, such as Eclipse / WebSphere Studio Application Developer (WSAD).

The latest Eclipse Checkstyle plug-in version can be downloaded from:

Checkstyle configuration file


Operating system used
Windows XP Home Edition Version 5.1 SP 2

Software prerequisites
Eclipse version 3.0 or higher
Checkstyle 4.0-beta4 or higher

  1. Start eclipse

  2. Select menu: Window | Preferences

  3. Select Checkstyle and press New button.

    Checkstyle preferences.

  4. A remote checkstyle configuration file will be used. Enter the following:

    Type: Remote Configuration
    Name: checkstyle
    Description: checkstyle

    Checkstyle configuration properties.

    Press OK button

  5. Press again the OK button to exit the Preferences window.

  6. To enable Checkstyle on a project right-click the project and select the project's properties.

    Enable "Checkstyle active for this project"
    Enable "Use simple configuration"
    Pull down menu select: " checkstyle"

    Enable checkstyle

    Press OK button.

  7. The checkstyle information is displayed in the "Problems" view.
    To display the Problems view, select menu: Window | Show View | Problems

    Problems view

  8. Verify if the filter is set to display checkstyle messages.
    Press the filter button and make sure "Checkstyle Problem" is selected.

    Checkstyle filter.

    Press OK button.

  9. Build the project and see the checkstyle messages in the Problem view.

  10. The checkstyle is based on the Sun coding convention ("Sun checks" configuration) but with the following modules disabled.

    GroupModuleWarning generated
    Javadoc Comments Package HTML Missing package documentation file.
    Size Violations Maximum Line Length Line is longer than 80 characters.
    Whitespace Tab Character Line contains a tab character.
    Coding Problems Hidden Field 'xx' hides a field.
    Class Design Design For Extension Method 'xx' is not designed for extension - needs to be abstract, final or empty.
    Miscellaneous Final Parameters Parameter xx should be final.
    Miscellaneous Generic Illegal Regexp Line has trailing spaces.