Don’t use the first - this is not the correct way of getting resources in Java/Kotlin. Resources are streams of data, not files. Build your application/library into jar, apk or whatever your project is, re-run the above code and you will see it won’t work. Other two options should be fine.
4 Likes