How to read files from resources folder in Scala?

前端 未结 6 939
渐次进展
渐次进展 2020-11-29 16:37

I have a folder structure like below:

- main
-- java
-- resources 
-- scalaresources
--- commandFiles 

and in that folders I have my files

6条回答
  •  天涯浪人
    2020-11-29 17:11

    For Scala >= 2.12, use Source.fromResource:

    scala.io.Source.fromResource("located_in_resouces.any")
    

提交回复
热议问题