I have a file placed in the same package as MyClass.java
that I need to load at runtime. I am using this code:
MyClass.class.getResource("file.xml")
however, the result is always null
. What am I doing wrong?
I have a file placed in the same package as MyClass.java
that I need to load at runtime. I am using this code:
MyClass.class.getResource("file.xml")
however, the result is always null
. What am I doing wrong?
I solved the problem by placing the file in R.raw folder, and then copying it at runtime. By doing this I was able to get the file path.