0
votes

Currently trying to setup my MacOS to have use Cucumber in my Eclipse. Currently using the JavaSE-1.8 and the noted referenced libraries down below. I'm not sure what the problem is, but I get an error about java.lang.NoClassDefFoundError: org/jdom2/JDOMException. I'm not sure why, I included the jdom2 and I still get the error when executing my cucumber feature file.

cucumber-java-1.2.4 cucumber-core-1.2.4 cucumber-jvm-deps-1.0.5 junit-4.12 gherkin-2.12.2 cucumber-html-0.2.3 hamcrest-all-1.3 cucumber-junit-1.2.4 jdom2-2.0.5

When I attempt to run a cucumber feature, I get the following error in my JUnit window.

java.lang.NoClassDefFoundError: org/jdom2/JDOMException
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
    at java.lang.Class.privateGetPublicMethods(Class.java:2902)
    at java.lang.Class.getMethods(Class.java:1615)
    at cucumber.runtime.java.MethodScanner.scan(MethodScanner.java:40)
    at cucumber.runtime.java.JavaBackend.loadGlue(JavaBackend.java:86)
    at cucumber.runtime.Runtime.<init>(Runtime.java:91)
    at cucumber.runtime.Runtime.<init>(Runtime.java:69)
    at cucumber.runtime.Runtime.<init>(Runtime.java:65)
    at cucumber.api.junit.Cucumber.createRuntime(Cucumber.java:78)
    at cucumber.api.junit.Cucumber.<init>(Cucumber.java:58)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at 
1

1 Answers

0
votes

jdom2-2.0.5.jar is not available at execution start up.

In eclipse select 'Run as' --> 'Run Configurations', on configurations window select class to run and click on 'Arguments' add below line in 'VM arguments'

-javaagent:{path}/jdom2-2.0.5.jar

and click on 'Run'