-1

I ve placed a pdf docment in the same place of my java class but I still got a NullPointer error. I need to place the pdf document in the same place of my class. this's my code:

    private static final String sourcePath = "rockTest.pdf";
    inputStream = MyClass.class.getResourceAsStream(sourcePath);

sourcePath is the name of the pdf document.

thanks

Inès Belhouchet
  • 491
  • 4
  • 8
  • 23

1 Answers1

0

Can you please try below

InputStream in = MyClass.class.getClassLoader().getResourceAsStream("rockTest.pdf");
A Paul
  • 8,113
  • 3
  • 31
  • 61