title: How to specify resourses path in a Java library?
body: <p>I prepared a Java library that makes downloadable PDF and HTML from a specific json file.
  The library contains a controller which can be called to get access to the page with links to download HTML and PDF files. I wanted to use the controller with Thymeleaf.</p>
  <p>The only problem is that when I add the library to projects the library cannot access resouses inside the jar file  - *.jpeg file which I use in PDF, and *.html which I wanted to use with the controller.</p>
  <p>Files themselves are in *.jar file of the library, but when I run the project I get an IO exception when the app tries to read the image. I tried different ways of writing file path, but even if I hardcode an absolute path of the image in the library it doesn't work.</p>
  <pre><code>onOpenDocumentjava.io.FileNotFoundException: /home/nikiforov-java/.m2/repository/ru/companyname/libname/LibName/1.0-SNAPSHOT/LibraryName-1.0-SNAPSHOT.jar!/img/image.jpeg
  </code></pre>
  <p>An Image class is from OpenPdf library - <code>import com.lowagie.text.Image;</code>
  This is how I try to read a jpeg file:</p>
  <pre><code>public Image image;
  image = Image.getInstance(&quot;/home/nikiforov-java/.m2/repository/ru/companyname/libname/LibName/1.0-SNAPSHOT/LibraryName-1.0-SNAPSHOT.jar!/img/image.jpeg&quot;);
  </code></pre>
  <p>Before extracting to a library the code was in the main project and there was no problem with resources. The issue appeared when I extracted this functionality into a library.</p>
  <p>In case of HTML template (documentation.html) I got an exception as well:
  [o.s.web.servlet.DispatcherServlet] - Failed to complete request: javax.servlet.ServletException: Could not resolve view with name 'documentation' in servlet with name 'dispatcherServlet'.</p>
  <p>I tried to change Thymeleaf resources using <code>spring.thymeleaf.prefix</code>, but it didn't help.</p>
  <p>Temporarily I just don't use *.jpeg file and return hardcoded HTML String from my controller.</p>
  <p>Please help me to figure out what I do wrong. Thanks.</p>