file location

I created a file under main/resources/xyz.txt and when I get the file and print it like this -

val commitFile: String = getClass.getResource("/xyz.txt").getFile

I see that its actually under target/scala-2.12/classes/xyz.txt

why is that? Is there a way I can change this?

Also is there a way I can write to this file or is it read only?

Please help

Hello,

It is not a Gatling specificity. It has to do with how the JVM loads resources.

In real runtime environment, it is inside a jar (a zip formatted file for the JVM).

This specific file will be read-only.

However, you can copy it where you want (ie a temporary file for example) and modify the copy and use that copy afterward.
But, again, keep in mind that is not a gatling specificity and you should look for resources usage in the JVM (either java or scala)

Cheers!