How to read files from resources folder in Scala?

前端 未结 6 937
渐次进展
渐次进展 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 16:55

    Onliner solution for Scala >= 2.12

    val source_html = Source.fromResource("file.html").mkString
    

提交回复
热议问题