Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9263857
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T13:41:16+00:00 2026-06-18T13:41:16+00:00

I want to read in the data from a csv-file and store it into

  • 0

I want to read in the data from a csv-file and store it into a database. This is how I saved the csv-file (this works without errors – just to show where and how the file is stored which I plan to read with CSVreader):

synchronized public void readFromUrl(String url, String outputFile, Context context) throws FileNotFoundException {
        URL downloadLink = null;
        try {
            downloadLink = new URL(url);
        } catch (MalformedURLException e2) {
            // TODO Auto-generated catch block
            e2.printStackTrace();
        }
        BufferedReader in = null;

        try {
                        in = new BufferedReader(
                                new InputStreamReader(downloadLink.openStream(), "UTF8"));
        } catch (IOException e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();
        }

        FileOutputStream fstream = context.openFileOutput(outputFile,Context.MODE_PRIVATE);

        Writer out = new OutputStreamWriter(fstream);

        Log.d(TAG, "BufferedReader "+in); 
        String inputLine = null;
        try {
            while ((inputLine = in.readLine()) != null){
                out.write(inputLine+"\n");
                //logger.debug("DOWNLOADED: "+inputLine);
            }
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        try {
            fstream.close();
            out.close();
            in.close();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

My code so far for reading the csv file:

public void readInCSVFile(String filename, Context context) throws IOException {
        IDbHelper dbHelper = new DbHelper(); ; 
        CSVReader products = null;

        products = new CSVReader(new InputStreamReader(context.getAssets().open(filename)));

I get a NoClassDefFoundError exception.

I have the opencsv.jar in the Referenced libraries of my android project.

Thanks in advance for your help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T13:41:18+00:00Added an answer on June 18, 2026 at 1:41 pm

    Is your project in the Eclipse IDE? If yes, then have a look whether the lib (opencsv.jar) is set in the “project properties->Java Build Path->Libraries” and that it is checked in the tab: “Order and Export” too. Under “Order and Export” move the lib to the top of the list.
    Then clean and rebuild.

    PS: If this does not help, then please provide the complete stacktrace of the error.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to read data from a CSV file using microsoft text driver. Can
In my application i have to read data from a CSV file. I want
Hi i want to read and write data from CSV and excel file both.Can
I want to read a csv file into an access database , here is
I want to read web service data from a website and display it into
I want to read data about MMORPG characters from a .txt file and then
I'm making chat application and read messages data from SQLite database. I want to
I have Uitable with data read from a AScii file. I want to select
i want simultaneously read and write data into file. Can i use StreamReader and
Possible Duplicate: Import CSV file directly into MySQL Export CSV from Mysql I want

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.