简体   繁体   English

Randoop的Java类路径问题

[英]Java Class Path issue with Randoop

I'm using Randoop, the automatic test generator for Java. 我正在使用Randoop,这是Java的自动测试生成器。

However, when running Randoop from the commandline, I can't seem to figure out how to properly specify the classpath. 但是,当从命令行运行Randoop时,我似乎无法弄清楚如何正确地指定类路径。

I read through this question: Java Classpath error-cannot find my class in detail but my setup seems a bit different. 我通读了这个问题: Java Classpath错误-无法详细找到我的类 ,但我的设置似乎有些不同。

I'm running on a Windows machine. 我在Windows机器上运行。

The overall project structure looks like this: 总体项目结构如下所示:

cse331/
    bin/
        hw5/
            GraphNode.class
    src/
        hw5/
            GraphNode.java
    randoop-2.1.4.jar

(There are some other files but the not important here, I think) (我认为还有一些其他文件,但在这里并不重要)

I tried calling: 我尝试致电:

java -ea -classpath randoop-2.1.4.jar:bin/* randoop.main.Main gentests --testclass=GraphNode --timelimit=20

But received the error: 但是收到错误:

Error: Could not find or load main class randoop.main.Main

I've tried several variations, loading in the .java file instead of the .class file for the classpath but no option has worked so far. 我尝试了几种变体,为类路径加载了.java文件而不是.class文件,但是到目前为止,没有任何选项起作用。 If I don't specify the class path at the end of randoop-2.1.4, I get an error message saying the class GraphNode cannot be found. 如果我未在randoop-2.1.4的末尾指定类路径,则会收到一条错误消息,提示找不到GraphNode类。

The setup is just the first step and I can't seem to get on the right track. 设置只是第一步,我似乎走错了方向。

Set classpath like below: 如下设置类路径:

-classpath "randoop-2.1.4.jar;bin/*"

For more details see Setting the class path 有关更多详细信息,请参见设置类路径。

最后,解决方案是从bin /中删除星号,并包括Sumit建议的半冒号。

java -ea -classpath randoop-2.1.4.jar;bin/ randoop.main.Main gentests --testclass=GraphNode --timelimit=20

Try this one: It will surely remove this error. 尝试以下一种方法:它一定会消除此错误。 java -cp cse331/bin;randoop-2.1.4.jar randoop.main.Main gentests --testclass=hw5.GraphNode --timelimit=100. java -cp cse331 / bin; randoop-2.1.4.jar randoop.main.Main gentests --testclass = hw5.GraphNode --timelimit = 100。

If your project is maven project, Try to include all dependencies. 如果您的项目是maven项目,请尝试包括所有依赖项。 for downloading use this command: mvn dependency:copy-dependencies 要下载,请使用以下命令:mvndependency:copy-dependencies

Let me know if you have any other queries regarding randoop. 让我知道您是否还有其他关于randoop的疑问。

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

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