0

I know that you can get a file in your jar with

InputStream resource = ClassLoader.getSystemResourceAsStream("com/foo/bar.txt");

Is it possible to do that with classes also, with something like:

InputStream yourclass = ClassLoader.getSystemResourceAsStream("com/foo/Clazz.class");

Edit: I checked it, and the seccond example does work. It just returns null. I am wondering if there is something that would do what the seccond example should.

user207421
  • 305,947
  • 44
  • 307
  • 483
mailmindlin
  • 616
  • 2
  • 7
  • 25

1 Answers1

0

Agree with code is fine. It's better to check if the path "com/foo/Clazz.class" is correct.

Paris Tao
  • 335
  • 1
  • 3
  • 11