I am trying to read a file as input stream and then convert the contents of the file into a list in scala. Here is my code
val fileStream = getClass.getResourceAsStream("src/main/scala-2.11/com/dc/returnsModel/constants/abc.txt")
val item_urls = Source.fromInputStream(fileStream).getLines.toList
This does now work. I get a NullPointer Exception. How do I correct this?
However, this works(but I cant use it in a JAR File)
val item_urls = Source.fromFile("src/main/scala-2.11/com/dc/returnsModel/constants/aa.txt").getLines.toList