eclipse 在java中导入CSVReader
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/29692526/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Import CSVReader in java
提问by Edwin Yeo
I'm trying to import the CSVReader into my Java project, but when I tried to build the project, it says that 'The import au cannot be resolved'.
我正在尝试将 CSVReader 导入到我的 Java 项目中,但是当我尝试构建该项目时,它显示“无法解析导入 au”。
I've added the opencsv-3.3.jar into my build path, and have imported the following in my source code.
我已将 opencsv-3.3.jar 添加到我的构建路径中,并在我的源代码中导入了以下内容。
import au.com.bytecode.opencsv.CSVReader;
import au.com.bytecode.opencsv.bean.ColumnPositionMappingStrategy;
import au.com.bytecode.opencsv.bean.CsvToBean;
What else could be missing or wrong that causes this issue?
还有什么可能导致此问题的缺失或错误?
回答by SubOptimal
You need to take the rigth Jar. For example you can take it from here mvnrepository.com
你需要拿正确的罐子。例如,您可以从这里获取它mvnrepository.com
This contains the packages au.com.bytecode.opencsv
and the repository is located at https://github.com/EmergentOrder/opencsvwhich is a fork of https://code.google.com/p/opencsv/
这包含包au.com.bytecode.opencsv
和存储库位于https://github.com/EmergentOrder/opencsv这是一个叉https://code.google.com/p/opencsv/
The project on https://code.google.com/p/opencsv/provide the packages com.opencsv
https://code.google.com/p/opencsv/上的项目提供了包com.opencsv
Depending which project you want to use. Maybe changing the package name in the import statement would fix it (when opencsv-3.3.jar is the Jar you need to use).
取决于您要使用的项目。也许更改 import 语句中的包名称会修复它(当 opencsv-3.3.jar 是您需要使用的 Jar 时)。