1

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?

user229044
  • 232,980
  • 40
  • 330
  • 338
Alessandro Roaro
  • 4,665
  • 6
  • 29
  • 48

1 Answers1

0

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.

Alessandro Roaro
  • 4,665
  • 6
  • 29
  • 48