【发布时间】:2011-03-15 20:01:16
【问题描述】:
类似于this question 我有一个小型 groovy 测试脚本,它基本上使用来自opencsv java 库的示例:
import au.com.bytecode.opencsv.CSVReader
CSVReader reader = new CSVReader(new FileReader("GroovyTest.csv"));
String [] nextLine;
while ((nextLine = reader.readNext()) != null) {
// nextLine[] is an array of values from the line
System.out.println(nextLine[0] + nextLine[1] + "etc...");
}
我不断收到错误消息“无法解析 au.com.bytecode.opencsv.CSVReader 类”。我什至将 opencsv jar 文件放在与我的脚本相同的目录中,但它无法识别它。我认为这是一个类路径问题,所以我尝试使用 -cp 标记只是收到相同的错误。
我以$ groovy testg.groovy的身份从命令行运行
【问题讨论】: