0

I am new to cucumber, I am trying to configure a Java-project without using Maven, I am having the following exception. I think there is an issue with the path of a .feature file

Exception:

java.lang.NoClassDefFoundError: cucumber/io/ResourceLoader
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2398)
at java.lang.Class.getConstructor0(Class.java:2708)
at java.lang.Class.getConstructor(Class.java:1659)
at cucumber.runtime.Utils.hasConstructor(Utils.java:30)
at cucumber.runtime.io.ClasspathResourceLoader.instantiateSubclasses(ClasspathResourceLoader.java:55)
at cucumber.runtime.Runtime.loadBackends(Runtime.java:81)
at cucumber.runtime.Runtime.<init>(Runtime.java:61)
at cucumber.api.junit.Cucumber.<init>(Cucumber.java:59)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:31)
at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:24)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:24)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.<init>(JUnit4TestReference.java:33)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestClassReference.<init>(JUnit4TestClassReference.java:25)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:48)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:452)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.ClassNotFoundException: cucumber.io.ResourceLoader
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 27 more

I have also attached the image of my project setup.

enter image description here

Any help will be awesome.

Thanks!

DB5
  • 13,553
  • 7
  • 66
  • 71
Zain
  • 5,391
  • 11
  • 34
  • 34
  • '@Zain': I am having the same problem. Please share me if you get any work around or solution for the raised question. It will be help full for me as well as others who look around in future. – Manigandan May 19 '14 at 12:00

2 Answers2

0
java.lang.NoClassDefFoundError: cucumber/io/ResourceLoader

this exception means that the class cucumber.io.ResourceLoader is not found in the classpath of your Project. Try to add the cucumber-core.jar to the classpath of your project following this eclipse documentation.

Ali HAMDI
  • 365
  • 1
  • 11
0

It would help if you could let us know what libraries you referenced in your project. cucumber-core is referenced by cucumber-java. So if you have cucumber-java, you don't need to have cucumber-core in your class path. Looking at your code, I notice you use @Cucumber.Options. This is deprecated in the latest release, so looks like you are not using latest release. Try using cucumber 1.1.5 jars.

Also any reason why aren't you using maven? Maven is supposed to make these things easier.

nilesh
  • 14,131
  • 7
  • 65
  • 79