I need to read a sample.csv file from the same class as my main. Below you can see the structure.
This is my code but when I run it it gave me the error that the sample.csv is not find!
public int convertFile(String csvFileName, String xmlFileName,
String delimiter) {
int rowsCount = -1;
BufferedReader csvReader;
try {
Document newDoc = domBuilder.newDocument();
// Root element
Element rootElement = newDoc.createElement("XMLCreators");
newDoc.appendChild(rootElement);
// Read csv file
csvReader = new BufferedReader(new FileReader(csvFileName));
CSVReader reader = new CSVReader(new FileReader("sample.csv"));
//CSVReader reader = new CSVReader(csvReader);
String[] nextLine;
int line = 0;
List<String> headers = new ArrayList<String>(5);
while ((nextLine = reader.readNext()) != null) {
....
Can anyone suggest me what is the problem?
