0

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 
Dorian
  • 13
  • 3

1 Answers1

0

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'

Aravin
  • 6,605
  • 5
  • 42
  • 58
  • Still left me with an error.... objc[5797]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.8.0_66.jdk/Contents/Home/bin/java and /Library/Java/JavaVirtualMachines/jdk1.8.0_66.jdk/Contents/Home/jre/lib/libinstrument.dylib. One of the two will be used. Which one is undefined. Failed to find Premain-Class manifest attribute in /Users/dorianflowers/thinkBox312/EclipseWorkSpace/Cucumber-Libraries/jdom2-2.0.5.jar Error occurred during initialization of VM agent library failed to init: instrument – Dorian Dec 21 '15 at 21:25
  • please check this link http://stackoverflow.com/questions/18794573/objc10012-class-javalaunchhelper-is-implemented-in-both-libinstrument-dyl – Anil Kumar Kadiri Dec 23 '15 at 15:44