title: How to run custom checkstyle rules?
body: <p>I want to create my rules. I saw this link: <a href="http://checkstyle.sourceforge.net/writingchecks.html" rel="nofollow">http://checkstyle.sourceforge.net/writingchecks.html</a>
  And I create a simple maven project, it contains only one class :</p>
  
  <pre><code>package com.posco.myapp;
  import com.puppycrawl.tools.checkstyle.api.*;
  public class MethodLimitCheck extends Check{
  
   private static final int DEFAULT_MAX = 30;
      private int max = DEFAULT_MAX;
  
      @Override
      public int[] getDefaultTokens()
      {
          return new int[]{TokenTypes.CLASS_DEF, TokenTypes.INTERFACE_DEF};
      }
  
      @Override
      public void visitToken(DetailAST ast)
      {
          // find the OBJBLOCK node below the CLASS_DEF/INTERFACE_DEF
          DetailAST objBlock = ast.findFirstToken(TokenTypes.OBJBLOCK);
          // count the number of direct children of the OBJBLOCK
          // that are METHOD_DEFS
          int methodDefs = objBlock.getChildCount(TokenTypes.METHOD_DEF);
          // report error if limit is reached
          if (methodDefs &gt; this.max) {
              log(ast.getLineNo(),
                  "too many methods, only " + this.max + " are allowed");
          }
          if (methodDefs &lt; this.max) {
              log(ast.getLineNo(),
                  "too many methods, only " + this.max + " are allowed");
          }
     }
  </code></pre>
  
  <p>And I put this code in my config.xml file</p>
  
  <pre><code>&lt;module name="TreeWalker"&gt;
      &lt;!-- myCheck.                     --&gt;
      &lt;module name="com.posco.myapp.MethodLimitCheck"&gt;
      &lt;/module&gt;
  </code></pre>
  
  <p>and then, I run with command line (after using maven to create myjar):</p>
  
  <pre><code>java -classpath my-core-1.0.jar:checkstyle-5.5-all.jar com.puppycrawl.tools.checkstyle.Main -c config.xml
  </code></pre>
  
  <p>The error is: classNotFoundException: com.puppycrawl.tools.checkstyle.gui.Main</p>
  
  <p>you would like to hep me !</p>