简体   繁体   中英

Randoop execution error, unable to load class due to exception

The exact error I'm getting is :

Error: Unable to load class "MainClass" due to exception: java.lang.NoClassDefFoundError: MainClass (wrong name: thiagodnf/sootparser/example/grocery/MainClass

Included is the Zip of the class files, which I have located in a file path of:

C:\\Eclipse\\Workspaces\\Refactor\\sootparser-master\\sootparser-example-grocery\\target\\classes\\thiagodnf\\sootparser\\example\\grocery

The class files can be found at this link:

There are a bunch of them in their own folders, so if there is a better way to share than a Gdrive link let me know. The folder on the link is called "grocery" it should be placed as the folder at the end of the file path ( it's not /grocery/grocery)

The command I am attempting to run is: C:\\Eclipse\\randoop> java -Xmx3000m -classpath C:\\Eclipse\\Workspaces\\Refactor\\soot parser-master\\sootparser-example-grocery\\target\\classes\\thiagodnf\\sootparser\\exa mple\\grocery;C:/Eclipse/randoop/randoop-all-4.1.1.jar randoop.main.Main gentests --testclass=MainClass

The source code is stored at this path:

C:\\Eclipse\\Workspaces\\Refactor\\sootparser-master\\sootparser-example-grocery\\src\\main\\java\\thiagodnf\\sootparser\\example\\grocery

The link to the source .java files are:

I renamed the folder so it wasn't as confusing for the upload, however it's original name is "grocery" and like the above path is not nested inside (/grocery/grocery)

My java version is:

>     > java Runtime Environment (build 1.8.0_201-b09) 
>     > Java HotSpot(TM) 64-Bit
>     > Server VM (build 25.201-b09, mixed mode)version "1.8.0_201" Java(TM) SE

So far I have tried different locations and paths to target "MainClass" I have moved it out as far as the the root, and also placed it in the same directory as the randoop jar file. Randoop seems to run against some other class files on my machine, so my concern is either the "MainClass" is not formatted in a way randoop can read it, or i'm missing something with my command, or location path.

The short term I would like it to run against MainClass, in the long run i'll need to do a class file list, and run it against all the classes in the different modules.

Thanks for anything you can do to help, or point me in the correct direction. If I can provide any more information or clarification please let me know.

Thank you!!

Please see:
https://dzone.com/articles/java-classnotfoundexception-vs-noclassdeffounderro
This gives a thorough explanation of what the two exception/error states ClassNotFoundException and NoClassDefFoundError mean and the differences between the states.
Hopefully this will help resolve your issue.

In short, it looks like there is some versioning issue, whereby some class or method in a class that is being used in your code (or code used by your code) is not available to the runtime.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM