1 Reply Latest reply: Dec 1, 2008 12:29 PM by 807589 RSS

    Referencing a resource in a jar file

    807589
      Hi everybody,
      I'm creating a JAR file and trying to reference a resource inside (while building the JAR with Eclipse), with the following structure:

      Project
      ->main source folder
      ->->classes (Main class is here)
      ->JRE System Library
      ->Manifest
      ->Resource

      I'm trying to reference my resource (which is a text file) in a FileReader in my main class.

      I tried to use relative file names, and tried all of these:
      new FileReader( "myFile.txt" );
      new FileReader( "../myFile.txt" );
      new FileReader( "../../myFile.txt" );
      In all these cases, I get a FileNotFoundException.

      Am I missing something stupid here? I have a feeling the answer is yes. Could one of you with a better set of eyes please let me know where I'm going wrong in my referencing?

      Thanks,
      Jezzica85