pitest icon indicating copy to clipboard operation
pitest copied to clipboard

ClassNotFoundException: org.pitest.functional.predicate.Predicate with command line

Open Iroski opened this issue 2 years ago • 1 comments

Hi I am trying to use command line version of pit to mutate a class in defects4j. My command line input is

java -cp ~/tools/pit/pitest-command-line-1.1.5.jar:~/tools/pit/pitest-1.1.5.jar:~/tools/junit/junit-4.12.jar \ 
org.pitest.mutationtest.commandline.MutationCoverageReport \
--reportDir ./output  \
--targetClasses org.apache.commons.lang3.math.NumberUtils \
--targetTests org.apache.commons.lang3.math.NumberUtilsTest \
--sourceDirs src/main/java

and the result shows an exception:

Exception in thread "main" java.lang.NoClassDefFoundError: org/pitest/functional/predicate/Predicate
        at java.lang.Class.getDeclaredMethods0(Native Method)
        at java.lang.Class.privateGetDeclaredMethods(Class.java:2625)
        at java.lang.Class.getMethod0(Class.java:2866)
        at java.lang.Class.getMethod(Class.java:1676)
        at sun.launcher.LauncherHelper.getMainMethod(LauncherHelper.java:494)
        at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:486)
Caused by: java.lang.ClassNotFoundException: org.pitest.functional.predicate.Predicate
        at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:358)

All the paths to the jars are valid and my java version is 1.8 I wonder what's wrong with this, thank you !

Iroski avatar Sep 26 '22 15:09 Iroski

Can you please try some recent versions such as 1.9.5 ? Version 1.1.5 is released about seven years ago and probably will not supported any more.

Ref:

  • https://github.com/hcoles/pitest/releases/tag/1.9.5
  • https://github.com/hcoles/pitest/releases/tag/pitest-parent-1.1.5

gmshake avatar Sep 27 '22 00:09 gmshake