Java-Cucumber-Junit-feature file setup error

While creating Java-Cucumber setup on running the Runner class i got this error:-

Exception in thread “main” java.lang.NoClassDefFoundError: gherkin/formatter/Formatter
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at cucumber.runtime.formatter.PluginFactory$1.<init>(PluginFactory.java:53)
at cucumber.runtime.formatter.PluginFactory.<clinit>(PluginFactory.java:52)
at cucumber.runtime.RuntimeOptions.<init>(RuntimeOptions.java:69)
at cucumber.api.cli.Main.run(Main.java:31)
at cucumber.api.cli.Main.main(Main.java:18)
Caused by: java.lang.ClassNotFoundException: gherkin.formatter.Formatter
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
… 17 more

Java-Cucumber-Junit-feature file setup error

Java-Cucumber-Junit-feature file setup error

Default Asked on May 13, 2016 in Selenium WebDriver.
Add Comment
  • 2 Answer(s)

    It looks like you are missing one cucumber library. Can you please cross verify from this page http://toolsqa.com/cucumber/configure-eclipse-cucumber/

    Virender

    Professor Answered on May 16, 2016.
    Add Comment

    According to this, cucumber-java-1.2.4 requires gherkin-2.12.2, while you are providing gherkin-4.0.0.

    You can download version 2.12.2 from here, remove version 4.0.0 and see if it works then (you may need to restart Eclipse).

    http://stackoverflow.com/questions/36771066/java-lang-noclassdeffounderror-exception-while-running-cucumber-test-using-junit

    Default Answered on March 18, 2017.
    Add Comment
  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.