bounds - Java application Error while reading a csv file using openCSV CSVReader ... java.lang.ArrayIndexOutOfBoundsException -


i error in java application when try read column each line of csv file

java.lang.arrayindexoutofboundsexception: 1 

my code using opencsv

    public void insertojd(string fichierentree) throws sqlexception {     try {          csvreader reader = new csvreader(new filereader(fichierentree));           string[] nextline;              while ((nextline = reader.readnext()) != null) {              if (nextline != null) {                   system.out.println(nextline[1]);                                 }}.... 

it's empty line or comment line in csv or that. error means there no 2nd value on row (nextline[1] second value). check file , print nextline[0] , see mistake. nextline[0] contain whole row. make sure tell opencsv use poper separator, escape character etc.


Comments

Popular posts from this blog

python 3 IndexError: list index out of range -

android - How to save instance state of selected radiobutton on menu -

IF statement in MySQL trigger -