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

  • Home
  • SEARCH
  • 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 8181979
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T00:42:13+00:00 2026-06-07T00:42:13+00:00

My current application needs to get data from a file to initialize its attributes.

  • 0

My current application needs to get data from a file to initialize its attributes.
It needs to be stored in a file to enable modification to the user.

String strFile = ClassLoader.getSystemResource("myFile.csv").getPath();
if(strFile==null)
        throw new Exception("File not find");
BufferedReader br = new BufferedReader(new FileReader(strFile));
//Begin reading file process..

My problem is that strFile is not null but I have a java.io.FileNotFoundException when br is initialized, see the following stack:

java.io.FileNotFoundException: C:\Users\TH951S\My%20Documents\Eclipse\Workspace
                                 \My%20App\bin\myFile.csv 
                                 (The system cannot find the path specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at java.io.FileReader.<init>(Unknown Source)

I checked that the file is in the designated path and everything seems correct.

Does anyone knows why this is happening? Or is there another way to get a file when the path is unknown?

Thanks for reading and more for answering,

  • 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-07T00:42:14+00:00Added an answer on June 7, 2026 at 12:42 am

    I solve my issue, one of those that make you feel stupid for not solving it sooner.

    URLs are encoding spaces with value %20 and Java do not replace the value by the space character when the FileReader is initialized. Therefore it is necessary to change %20 by " ".

    There is also another way of counturning it. It is also possible to initialize the BufferedReader with an InputStreamReader as following:

    InputStream in=ClassLoader.getSystemResourceAsStream("myFile.csv");
    BufferedReader br = new BufferedReader(new InputStreamReader(in));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am building a desktop application that needs to update current user's status frequently.
I am working on an Android application that needs to determine the current tee
In my C# application, I need to check if the current user is a
I'm trying to get the current application name (the application that contains the current
I have an SQL query I get from a configuration file, this query usually
I am busy working on a mobile application that retrieves data from a web
I have a web application that uses the current version of JQuery that needs
In my Grails application I need to create a file in current system in
My application is an apporval system.I am creating data view from a task list
I'd like to measure memory allocation data from my java application, i.e. the sum

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.