Java Eclipse--.txt File Not Found When Exported To .jar
eclipse, java, user-interface
Solution
You should not access that file using `FileInputStream`. Get an `InputStream` using the class loader and `getResourceAsStream()`. It'll find it in the JAR.
Problem
So I've created a game, runs perfectly in eclipse--all of the images load and it reads properly from a text file. The text file provides level info. This is where my problem comes in. I exported it all to an executable .jar file, and it found all of the images. But it did not find the .txt file. Where does the .txt file need to be for it to be found? ``` try{ controlBoard = new Scanner(new FileInputStream("lvl1.txt")); }catch(Exception e){ gb.error = true; } ```