odbhut.shei.chhele
odbhut.shei.chhele

Reputation: 6264

Getting cannot find file exception in Play Framework

I have a file called product.csv in my application root. I want to read from the file. But I am getting file not found exception. Here is the code I have written.

val lines = scala.io.Source.fromFile("/product.csv").mkString
println(lines)

What am I doing wrong?

I am using Windows OS.

Upvotes: 0

Views: 110

Answers (1)

Callum
Callum

Reputation: 879

You need to use a relative filepath "product.csv" rather than "/product.csv" which will look at the root of your drive.

Upvotes: 1

Related Questions