I have the following code structure:
Projects/ classes/ performance/AcPerformance.class resources/ Aircraft/ allAircraft.txt
I have the contents of the class folder in the JAR, and my Acperformance scala code is trying to read the contents of the text files of the Aircraft folder. My code is:
val AircraftPerf = getClass.getResource("resources/Aircraft").getFile val dataDir = new File(AircraftPerf) val acFile = new File(dataDir, "allAircraft.txt") for (line <- linesFromResource(acFile)) { // read in lines }
When I try to run the code, I get the following error:
Called: java.io.FileNotFoundException: C: \ Projects \ file: \ C: \ Projects \ libraries \ aircraft.jar! \ Aircraft \ allAircraft.txt (Invalid file name, directory or volume name)
Is it right to read the contents of the JAR? Thanks!
source share