Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 16030

How do I fix this FileNotFoundError for binary file creation?

$
0
0

I have a program that gives the user a survey and saves the data gathered to different binary files for different political parties. I have this class:

public class MyClass {    //PoliticaParty is an enum for political parties (Republican, Democrat, and Libertarian        public PoliticalParty party;     private final String filePath;    private List<byte[]> previousSurveyData;    public ProbabilityManager(PoliticalParty party) {        this.party = party;        filePath = "data/" + party.name().toLowerCase() +".bin";        previousSurveyData = SurveyFilesIO.readFromBinaryFile(filePath);        //The filepath is passed to the above method from another class I have to read the information.    }

Whenever I run this, I get a FileNotFoundException. I would really appreciate some help.Thanks!

I'm writing this in Eclipse, so I was trying to see if I need to have a resources folder in there, but I'm not sure about that. I'm going to be sending the finished project to someone, so I just don't want to run into any issues. I have mostly worked with text files, so this is unfamiliar territory.


Viewing all articles
Browse latest Browse all 16030

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>