简体   繁体   English

Randoop执行错误,由于异常无法加载类

[英]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 错误:由于异常而无法加载类“MainClass”:java.lang.NoClassDefFoundError:MainClass(错误的名称:thiagodnf / sootparser / example / grocery / MainClass

Included is the Zip of the class files, which I have located in a file path of: 包含类文件的Zip,我位于以下文件路径中:

C:\\Eclipse\\Workspaces\\Refactor\\sootparser-master\\sootparser-example-grocery\\target\\classes\\thiagodnf\\sootparser\\example\\grocery C:\\ Eclipse的\\工作区\\重构\\ sootparser主\\ sootparser-示例-杂货\\目标\\类\\ thiagodnf \\ sootparser \\示例\\杂货

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. 他们自己的文件夹中有很多,所以如果有比Gdrive链接更好的分享方式让我知道。 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 我试图运行的命令是: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 C:\\ Eclipse的\\工作区\\重构\\ sootparser主\\ sootparser-示例-杂货\\ SRC \\主\\的java \\ thiagodnf \\ sootparser \\示例\\杂货

The link to the source .java files are: 源.java文件的链接是:

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版本是:

>     > 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. 到目前为止,我尝试了不同的位置和路径来定位“MainClass”我已将其移出到根目录,并将其放在与randoop jar文件相同的目录中。 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. Randoop似乎与我机器上的其他类文件运行,所以我担心的是“MainClass”没有以randoop可以读取它的方式格式化,或者我错过了我的命令或位置路径。

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. 短期我希望它能够针对MainClass运行,从长远来看,我需要做一个类文件列表,并针对不同模块中的所有类运行它。

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 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. 这给出了两个异常/错误状态ClassNotFoundException和NoClassDefFoundError意味着什么以及状态之间差异的详尽解释。
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. 简而言之,看起来存在一些版本控制问题,因此运行时无法使用代码中使用的类(或代码使用的代码)中的某些类或方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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