一、报错 : 『Could not find class』

下面给出三个示例比较,其中只有第一个是正确的。

1.
MyComputer:bin marikobayashi$ java -cp .:./junit-4.10.jar org.junit.runner.JUnitCore NextdayTest
JUnit version 4.10
...............
Time: 0.016 OK (15 tests) 2.
MyComputer:bin marikobayashi$ java -cp .:./junit-4.10.jar org.junit.runner.JUnitCore ./NextdayTest
JUnit version 4.10
Could not find class: ./NextdayTest Time: 0.002 OK (0 tests) 3.
MyComputer:bin marikobayashi$ java -cp ./junit-4.10.jar org.junit.runner.JUnitCore ./NextdayTest
JUnit version 4.10
Could not find class: ./NextdayTest Time: 0.001 OK (0 tests)

二、 分析

java -cp .:./junit-4.10.jar org.junit.runner.JUnitCore NextdayTest

  1. -cp 指类路径 : "." 指的是当前路径,一定要有; 『:』 是分隔符, 『./junit-4.10.jar』 指当前路径下的./junit-4.10.jar包,也可以在其他路径下
  2. org.junit.runner.JUnitCore : 测试框架入口
  3. NextdayTest :待测Junit 测试用例+脚本 类。 PS : 前面不要加 路径,否则可能找不到(会被一并认为测试脚本类名)

Junit 命令行测试 报错:Could not find class 理解及解决方法的更多相关文章

  1. rpm方式安装MySQL后在命令行登录报错:ERROR 1045 (28000): Unknown error 1045

    1.通过https://mirrors.tuna.tsinghua.edu.cn镜像源安装了MySQL5.7.22 rpm -ivh --force --nodeps https://mirrors. ...

  2. 解压tar.gz文件报错gzip: stdin: not in gzip format解决方法

    解压tar.gz文件报错gzip: stdin: not in gzip format解决方法 在解压tar.gz文件的时候报错 1 2 3 4 5 [Sun@localhost Downloads] ...

  3. 含有package关键字的java文件在命令行运行报错

    程序中含有package关键字,使用命令行运行程序时出现"找不到或无法加载主类",而使用Eclipse软件可以正常运行程序的可能解决办法. 在包下的类,在Java源文件的地方编译后 ...

  4. docker mac 命令行登录报错处理 : Error saving credentials: error storing credentials - err: exit status 1

    参考:https://blog.csdn.net/xufwind/article/details/88756557 比较新版本的docker命令行登录会出现以下错误: Error saving cre ...

  5. 安装 R 包报错 clang: error: unsupported option '-fopenmp' 的解决方法

    MacOS 上安装 R 包 install.packages("data.table") 后面提示是否安装需要编译的版本: Do you want to install from ...

  6. 问题:eclipse中线程编程编译报错,undefined reference to 'pthread_create'的解决方法(已解决)

    问题描述: 在Ubuntu系统中,使用eclipse CDT集成开发环境编写pthread程序,编译时,pthread_create不通过,报错信息是: undefined reference to ...

  7. 安装CentOS 6.x报错"Disk sda contains BIOS RAID metadata"解决方法

    今天在安装CentOS 6.2的时候,当进到检测硬盘的时候,总是过不去,报错如下: Disk sda contains BIOS RAID metadata, but is not part of a ...

  8. scp报错:not a regular file,解决方法:加参数 -r

    命令:scp  -P1234  /data/aa   root@192.0.0..0:/data 文件结构:/data/aa/yearmonth=2015-09 报错:not a regular fi ...

  9. MyEclipse 启动报错:'Building workspace' has encountered a problem解决方法

    转载于:http://blog.csdn.net/v123411739/article/details/42645159 每次MyEclipse工作空间报错如下:'Building workspace ...

随机推荐

  1. 反序列化失败Failed to deserialize --- local class incompatible: stream classdesc serialVersionUID

    反序列化失败: java.lang.IllegalStateException: Failed to execute CommandLineRunner at org.springframework. ...

  2. Creating adaptive web recommendation system based on user behavior(设计基于用户行为数据的适应性网络推荐系统)

    文章介绍了一个基于用户行为数据的推荐系统的实现步骤和方法.系统的核心是专家系统,它会根据一定的策略计算所有物品的相关度,并且将相关度最高的物品序列推送给用户.计算相关度的策略分为两部分,第一部分是针对 ...

  3. ArcGIS自定义工具箱-字段分割

    ArcGIS自定义工具箱-字段分割 联系方式:谢老师,135-4855-4328,xiexiaokui#qq.com 目的:用指定分割符分割字段, 用例:湖南省长沙市=>湖南/长沙 数据源: 使 ...

  4. eclipse修改工作目录颜色

    转载请注明本地址,http://blog.csdn.net/u013173247/article/details/41676495 经常用Eclipse的朋友都应该清楚,Eclipse的白背景不知道晃 ...

  5. 十一、Composite 组合模式

    原理: 代码清单 Entity public abstract class Entry { public abstract String getName(); public abstract int ...

  6. Pandas重塑和轴向旋转

    重塑和轴向旋转 Se import pandas as pd import numpy as np from pandas import Series data=pd.DataFrame(np.ara ...

  7. Python设计模式 - UML - 包图(Package Diagram)

    简介 包图是对各个包及包之间关系的描述,展现系统中模块与模块之间的依赖关系.一个包图可以由任何一种UML图组成,可容纳的元素有类.接口.组件.用例和其他包等.包是UML中非常常用的元素,主要作用是分类 ...

  8. zabbix-3.4.10系列

    第1节 zabbix体系架构图:

  9. [leetcode]17. Letter Combinations of a Phone Number手机键盘的字母组合

    Given a string containing digits from 2-9 inclusive, return all possible letter combinations that th ...

  10. 28.Mysql权限与安全

    28.Mysql权限与安全28.1 Mysql权限管理 28.1.1 权限系统的工作原理对连接的用户进行身份认证,合法的用户通过认证,不合法的用户拒绝连接:对通过认证的合法用户赋予相应的权限,用户可以 ...