0

I have a little problem with a part of the code. I have an offline version of my website inside my jar file, if the user needs help he can click on a button to open the HTML file where the software operations are explained.

In Eclipse it works fine when i use this lines if the help button is pressed :

URL url = getClass().getClassLoader().getResource("assets/help/index.html");

Desktop.getDesktop().browse(url.toURI());

However in the jar it doesn't works, i know i should use :

(getClass().getClassLoader().getResourceAsStream(resourcePath))

to get a resource located inside a jar file. But this function returns an InputStream object, whereas I need a URI or URL object if I want to use the browse(URI uri) method.

Therefore how could I succeed to open this file? Thanks for your answers!

Devratna
  • 938
  • 1
  • 7
  • 26
Stalk
  • 19
  • 5
  • Possible duplicate of [Is it possible/how to embed and access HTML Files in a JAR?](https://stackoverflow.com/questions/18443315/is-it-possible-how-to-embed-and-access-html-files-in-a-jar) – Volker Stolz Oct 31 '19 at 05:23
  • Is the file in the JAR? Under that path? – user207421 Oct 31 '19 at 07:29

0 Answers0