How to read files from resources folder in Scala?

前端 未结 6 924
渐次进展
渐次进展 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:04

    The required file can be accessed as below from resource folder in scala

    val file = scala.io.Source.fromFile(s"src/main/resources/app.config").getLines().mkString
    

提交回复
热议问题