Randoop的Java类路径问题



我使用的是Randoop,Java的自动测试生成器。

然而,当从命令行运行Randoop时,我似乎不知道如何正确地指定类路径。

我仔细阅读了这个问题:Java Classpath错误找不到我的类的详细信息,但我的设置似乎有点不同。

我在Windows机器上运行。

整个项目结构如下:

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

(还有一些其他文件,但这里不重要,我认为)

我试着打电话:

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

但收到错误:

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

我已经尝试了几种变体,在类路径的.java文件而不是.class文件中加载,但到目前为止没有任何选项起作用。如果我没有在randoop-2.1.4的末尾指定类路径,我会收到一条错误消息,说找不到类GraphNode。

设置只是第一步,我似乎无法走上正轨。

最终,解决方案是从bin/中删除星号,并包含Sumit建议的分号。

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

试试这个:它肯定会消除这个错误。java-cp cse331/bin;randoop-2.1.4.jar randoop.main.main gentests--testclass=hw5.GraphNode--timelimit=100。

如果您的项目是maven项目,请尝试包含所有依赖项。要下载,请使用以下命令:mvn-dependencies:copy dependencies

如果您对randoop有任何其他疑问,请告诉我。

最新更新