Import CSV file in Java

In the program I am writing, I want to be able to import CSV files. At the moment, it occupies the main text file.

File mainemails = new File ("mainemails.txt"); 

I know that importing a CSV using a file is probably not the most economical thing to use. What would be the most efficient way to import a CSV file? Should I download any new libraries to use an efficient method?

+8
java csv
source share
2 answers

You can use opencsv to import csv data and then to create objects from it.

I prefer to use libraries to save development time. In addition, they tend to solve specific problems better.

+12
source share

Try OpenCSV as suggested here and.

+5
source share

All Articles