1 Reply Latest reply on Nov 9, 2012 1:09 AM by jschellSomeoneStoleMyAlias

    Relative Path...?


      I have two .txt files I would like to add to a jar file for my program to read from. I'm not sure how the program is to read from the file if given the name of the file only. I can't give it the direct path to the files because when the jar file moves, they cannot be read. How would I be able to give the path to the files and have the jar read them where ever the jar is?

      Thank You,
        • 1. Re: Relative Path...?
          Presumably you ONLY want to read from them, never write, then the files are treated as a 'resource".

          Googling with the following seem to provide solutions to that.

          java io jar resource

          If you want to write to those files then you MUST extract them from the jar and put them into the file system. And of course once you put them into the file system, you will explicitly know where they are.