0

I am taking an edX course and for one of the home work assignments, it has me downloading two jar files and testing my code. I was able to successfully run both jar files in Eclipse by adding them to the build path.

However, looking up similar means for Intellij, I cannot get the tests.jar to work and am receiving the below error:

Exception in thread "main" java.lang.NoClassDefFoundError: org/junit/runner/JUnitCore
    at Homework1Grader.main(Homework1Grader.java:8)
Caused by: java.lang.ClassNotFoundException: org.junit.runner.JUnitCore
    at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
    ... 1 more

I have tried adding the jar files themselves as dependencies or as libraries but neither method seemed to have worked. I included a screenshot of my project structure here. Also to mention, I have both jar files in the project's root directory. I think this might be an issue with the packaging but I am not sure. I assume if a package is not specified, Intellj takes everything in the default package.

I have also included the java files and the jar files I was meant to test it with below.

https://courses.edx.org/assets/courseware/v1/276899496d83bbfb170d072d6eb754be/asset-v1:PennX+SD2x+3T2020+type@asset+block/LinkedListUtils.java

https://courses.edx.org/assets/courseware/v1/2ed6e73287692ad54165a95ba8e5ac11/asset-v1:PennX+SD2x+3T2020+type@asset+block/junit-dist.jar

https://courses.edx.org/assets/courseware/v1/4d42e8c8b68c3ea62e80da2374dc8739/asset-v1:PennX+SD2x+3T2020+type@asset+block/homework1-tests.jar

0 Answers0