4

First of all, hello and sorry for the beginner question but I already saw the documentation and tutorials but I can't make it work on my code. Maybe I'm making a little mistake but I can't catch it.

I'm using the latest version of opencsv in a maven project. So I need to make a .csv file and for that I use:

try (CSVWriter writer = new CSVWriter(new FileWriter("file.csv", true)) {
    /* code
}

And everything works fine, but I need to use a diferent separator, so I try with:

try (CSVWriter writer = new CSVWriter(new FileWriter("file.csv", true), '-') {
    /* code
}

But appears Cannot resolve constructor 'CSVWriter(java.io.FileWriter, char)' in IntelliJ, when in the documentation says opencsv documentation

Any idea on how fix it? (Sorry for my english, I'm not native speaker).

1 Answers1

2

According to the documentation, the constructor is either just the file or 5 parameters, so you cannot have just 2: http://opencsv.sourceforge.net/apidocs/com/opencsv/CSVWriter.html

Chris
  • 156
  • 1
  • 7
  • 1
    Haha thank you so much!, that was my mistake. I swear read better the next time. –  Aug 03 '20 at 22:31