目前正在尝试设置我的MacOS,以便在我的Eclipse中使用黄瓜。目前正在使用JavaSE-1.8和下面提到的引用库。我不确定问题出在哪里,但是我得到了一个关于java.lang.NoClassDefFoundError的错误: org/jdom2/JDOMException。我不知道为什么,我包含了jdom2,但在执行我的黄瓜特征文件时仍然出现错误。
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
当我尝试运行黄瓜特性时,我在JUnit窗口中得到以下错误。
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 发布于 2015-12-22 05:02:09
jdom2-2.0.5.jar在执行启动时不可用。
在eclipse中选择'Run as' --> 'Run Configurations',在配置窗口中选择要运行的类,然后单击'Arguments'在'VM arguments'中添加下面的行
-javaagent:{path}/jdom2-2.0.5.jar然后单击'Run'
https://stackoverflow.com/questions/34403943
复制相似问题