I am trying to open a txt file in NetBeans 12.6 using Java. I placed the txt file in the main project file. When I try to open the file using the File and Scanner method I keep getting the "Unreported exception FileNotFoundException" error. Is there a new place you're supposed to put the txt file with 12.6? I am using a mac so I don't know if that is adding to the problem. It used to work fine when I was using NetBeans 8. Here is my code:
File bookList = new File("BookPrices.txt");//File to be opened
Scanner inputFile = new Scanner(bookList);//Scanner for the file of books
I figured it out! I needed to put it in a Try/Catch