title: Exception in thread "main" java.lang.NoClassDefFoundError: gherkin/formatter/Formatter
body: <p>I am learning how to write BDD test scripts in JAVA using Cucumber.  However, I keep getting the above error and not sure why.  I have the Cukes Gherkin as a dependency.</p>
  
  <p><strong>POM</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project xmlns="http://maven.apache.org/POM/4.0.0"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
      &lt;groupId&gt;Cucumber&lt;/groupId&gt;
      &lt;artifactId&gt;Cucumber&lt;/artifactId&gt;
      &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
  
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;info.cukes&lt;/groupId&gt;
              &lt;artifactId&gt;gherkin&lt;/artifactId&gt;
              &lt;version&gt;1.2.4&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;info.cukes&lt;/groupId&gt;
              &lt;artifactId&gt;cucumber-junit&lt;/artifactId&gt;
              &lt;version&gt;1.2.4&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;junit&lt;/groupId&gt;
              &lt;artifactId&gt;junit&lt;/artifactId&gt;
              &lt;version&gt;4.12&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;info.cukes&lt;/groupId&gt;
              &lt;artifactId&gt;cucumber-jvm-deps&lt;/artifactId&gt;
              &lt;version&gt;1.0.5&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
              &lt;exclusions&gt;
                  &lt;exclusion&gt;
                      &lt;groupId&gt;com.thoughtworks.xstream&lt;/groupId&gt;
                      &lt;artifactId&gt;xstream&lt;/artifactId&gt;
                  &lt;/exclusion&gt;
                  &lt;exclusion&gt;
                      &lt;groupId&gt;com.googlecode.java-diff-utils&lt;/groupId&gt;
                      &lt;artifactId&gt;diffutils&lt;/artifactId&gt;
                  &lt;/exclusion&gt;
              &lt;/exclusions&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;info.cukes&lt;/groupId&gt;
              &lt;artifactId&gt;cucumber-core&lt;/artifactId&gt;
              &lt;version&gt;1.2.4&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;info.cukes&lt;/groupId&gt;
              &lt;artifactId&gt;cucumber-java&lt;/artifactId&gt;
              &lt;version&gt;1.2.4&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;info.cukes&lt;/groupId&gt;
              &lt;artifactId&gt;cucumber-picocontainer&lt;/artifactId&gt;
              &lt;version&gt;1.2.4&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.picocontainer&lt;/groupId&gt;
              &lt;artifactId&gt;picocontainer&lt;/artifactId&gt;
              &lt;version&gt;2.15&lt;/version&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  
      &lt;repositories&gt;
          &lt;repository&gt;
              &lt;id&gt;codehaus&lt;/id&gt;
              &lt;url&gt;http://repository.codehaus.org&lt;/url&gt;
          &lt;/repository&gt;
      &lt;/repositories&gt;
  
      &lt;profiles&gt;
          &lt;profile&gt;
              &lt;id&gt;junit-4.12&lt;/id&gt;
              &lt;properties&gt;
                  &lt;junit.version&gt;4.12&lt;/junit.version&gt;
              &lt;/properties&gt;
          &lt;/profile&gt;
  
      &lt;/profiles&gt;
  
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
                  &lt;version&gt;3.3&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;source&gt;1.7&lt;/source&gt;
                      &lt;target&gt;1.7&lt;/target&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-jar-plugin&lt;/artifactId&gt;
                  &lt;version&gt;2.5&lt;/version&gt;
              &lt;/plugin&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-clean-plugin&lt;/artifactId&gt;
                  &lt;version&gt;2.6.1&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;filesets&gt;
                          &lt;fileset&gt;
                              &lt;directory&gt;.&lt;/directory&gt;
                              &lt;includes&gt;
                                  &lt;include&gt;**/*.ser&lt;/include&gt;
                              &lt;/includes&gt;
                          &lt;/fileset&gt;
                      &lt;/filesets&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  
  &lt;/project&gt;
  </code></pre>
  
  <p><strong>Feature</strong></p>
  
  <pre><code>Feature: Letter
  
  
      Scenario: Check Letter
      Given I have the letter "A"
        When Icheck the letter "A"
        Then I should see an output
  </code></pre>
  
  <p><strong>Steps</strong></p>
  
  <pre><code>package cucumber.steps;
  import cucumber.api.CucumberOptions;
  import cucumber.api.java.en.*;
  import cucumber.api.junit.Cucumber;
  import org.junit.Assert;
  import org.junit.runner.RunWith;
  
  /**
   * Created by Dustin on 8/31/2015.
   */
  
  @RunWith(Cucumber.class)
  @CucumberOptions(
          plugin = {"json-pretty", "html:target/cucumber"},
          features = "src/main/java/cucumber/steps/LetterStepDefs"
  )
  
  public class LetterStepDefs {
  
      private String letter;
      private String message;
  
      @Given("^I have the letter \"([^\"]*)\"$")
      public void I_have_the_letter(String letter) throws Throwable {
          // Express the Regexp above with the code you wish you had
          this.letter = letter;
      }
  
      @When("^Icheck the letter \"([^\"]*)\"$")
      public void Icheck_the_letter(String letter) throws Throwable {
          // Express the Regexp above with the code you wish you had
          try
          {
              Assert.assertEquals(this.letter, letter);
          }
          catch (Exception exc)
          {
              message = exc.getMessage();
          }
      }
  
      @Then("^I should see an output$")
      public void I_should_see_an_output() throws Throwable {
          // Express the Regexp above with the code you wish you had
          System.out.println(message);
      }
  }
  </code></pre>
  
  <p><strong>Output</strong></p>
  
  <pre><code>Testing started at 4:41 PM ...
  Connected to the target VM, address: '127.0.0.1:58473', transport: 'socket'
  JUnit version 4.12
  Exception in thread "main" java.lang.NoClassDefFoundError: gherkin/formatter/Formatter
      at java.lang.ClassLoader.defineClass1(Native Method)
      at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
      at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
      at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
      at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
      at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
      at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Class.java:274)
      at org.junit.internal.Classes.getClass(Classes.java:16)
      at org.junit.runner.JUnitCommandLineParseResult.parseParameters(JUnitCommandLineParseResult.java:100)
      at org.junit.runner.JUnitCommandLineParseResult.parseArgs(JUnitCommandLineParseResult.java:50)
      at org.junit.runner.JUnitCommandLineParseResult.parse(JUnitCommandLineParseResult.java:44)
      at org.junit.runner.JUnitCore.runMain(JUnitCore.java:72)
      at org.junit.runner.JUnitCore.main(JUnitCore.java:36)
  Caused by: java.lang.ClassNotFoundException: gherkin.formatter.Formatter
      at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
      at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
      ... 20 more
  Disconnected from the target VM, address: '127.0.0.1:58473', transport: 'socket'
  
  Process finished with exit code 1
  </code></pre>
  
  <p>Any help is much appreciated!</p>