1 Reply Latest reply on Dec 1, 2008 6:29 PM by 807589

    Referencing a resource in a jar file

      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:

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

      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?