1

Currently, I am working on a project that requires me to utilize the Randoop tool to generate tests for a testjar named TEST.jar. To achieve this, I need to dynamically create a classpath consisting of jars from a directory named ABC, which contains thousands of jars. Command to generate test on TEST.jar->

java -classpath myclasspath:${RANDOOP_JAR} randoop.main.Main gentests --testjar=TEST.jar --output-limit=100

Here, RANDOOP_JAR is path of randoop-all-4.3.2.jar myclasspath= Classpath required for generating test on TEST.jar. Basically It is a list of path of jar present in ABC directory.

I ran above command and it threw java.lang.NoClassDefFoundError and then I used shellscript to find the jar in ABC directory having that class. Shellscript:

for i in $(ls -R ABC/*.jar);do jar -tvf $i | grep missing-class && echo $i;done

Here missing-class refers to a class that was not found by the Java Virtual Machine (JVM) at runtime, resulting in a java.lang.NoClassDefFoundError.

Above is basically naive and also time consuming.

My problem is that-> Is their any tool or method so that myclasspath can be discovered automatically. I need a tool or method in which I can pass the TEST.jar and ABC directory as input and its output is list of jars(myclasspath).

maverick
  • 11
  • 2

0 Answers0