For the Personal Narrative project, one of my students was attempting to use the FileReader to read data from text files for use in his 2d arrays, but is receiving an error. Can FileReader be used with the Theater? Does something specific need to be imported to access FileReader methods?
Literally having the same problem Carl! I submitted a bug report because it seems like FileReader was moved to be a hidden class in this year’s curriculum as noted here:
But it is just not working! I’ve gone back to creating the FileReader class and implementing it like last year’s curriculum and it works. But the hidden class isn’t working in the sandbox or the project area.
Hi @cshuptrine! Thank you for bringing that up and as @jhyatt has said, it is a known issue. I’m not sure if the development team is aware of this or not but I will do some digging and get back to this post as soon as I know. Also, this link should get you directly to a lesson with FileReader in it and you can do as @jhyatt has done and just include those files for your student in the meantime.
Thanks for the reply @sam_stafford
I logged it as a known bug @cshuptrine and received a reply, copied below, from Andrew on the support team. I’m going to give it a try later today and tomorrow to see if it implemented and will report back. My students were working on the 1-day version of the Personal Narrative project and that is what I logged the bug about - so not sure if it will be implemented in the regular project - Lesson 10 - or any other lesson. But he notes it will not work on any sandbox level.
We appreciate you reporting this!
Our team has now added the FileReader class to Lesson 14. You should see this in the next few days when our system updates.
These reports help us make our site and offerings better for everyone, so thanks again for taking the time to send us this information!
Please be aware that the FileReader class will not be present on any sandbox level. Here are 2 projects that you can copy that class from:
These both serve different types of data. You will need to click “New File” and rename the file FileReader.java , Then you can copy/paste the class code from these links into your Java project. This will not work on levels where FileReader is already present as a support file (can’t have two files with the same name). However, it will work on all project / sandbox levels.
Hi Mr. Hyatt,
I just went in to U5L14, and created a simple text file, and then used the FileReader to read each line into an array. I then printed out the words and they appeared in the console. It worked for me just now, here is a screenshot of my code:
Please reach out here or to support@code.org if you are not able to get the FileReader working on your end.
Thanks for alerting the team to this issue!
Thanks for checking in with me Lindsay. It is still not working for me. My code was similar. But just to be sure I copied your code and still get a FileReader error. Here is a screenshot of my code and console with errors:
When I do create the FileReader class (the old way) - it does work. But not this way - which is using the “hidden class” - if I understand it correctly.
-Jason
Oh no! I’m sorry you are having this issue!
To get things working in class with your students, continuing to create the FileReader class the old way is probably the simplest thing to do.
If you could email this screenshot to support@code.org, so that the team knows the update has not reached all users, that would be helpful.
Thank you for your patience with this issue!
Lindsay