0

I'm working on a application, but when i try to run it as a .jar file i have some problems with reading a html file, who is in my src folder. Note that there is no problem doing this while i'm running this in eclipse.

code:

BufferedReader in = new BufferedReader(new FileReader("src/Text/testText.html"));

Normally this works fine, but after creating a .jar and running it, it gives me the following error: No such file or directory.

Does someone know what I do wrong?

  • First make sure your html file is being packaged as part of your jar. Since a jar is just a .zip file you should be able to open it and see. But if t is follow the link in my close vote. – Robert Moskal Jul 30 '15 at 14:51
  • I can see it when im opening my jar like a zip file. Tried this: InputStream inS = getClass().getResourceAsStream("Text/testText.html"); BufferedReader in = new BufferedReader(new InputStreamReader(inS)); Still nothing changes – whoopwhoopKlJK Jul 30 '15 at 16:16
  • 1
    Solved it! Did: InputStream inS = getClass().getResourceAsStream("/Text/testText.html"); Thanks for the fast reply!\ – whoopwhoopKlJK Jul 30 '15 at 16:26

0 Answers0