2

lately I got a bit confused concerning class-pathes in Manifest.mf-files. So what I want is to outsource some properties.files out of my distribution.jar and put them next to it without changing java-source-files.

Following example: At this time I can open a properties-file like this:

this.getClass().getClassLoader().getRessourceAsStream( "/config/jdbc.properties" );

The jdbc.properties are located in an eclipse sourcefolder called 'resources' with a package named 'config'. Now when I build the distribution I outsource them in a folder next to the distribution.jar, but I still wonna find them without changing the shown sourcecode.

Only generell solution which worked until now (without absolout pathes) was the following manifest.mf:

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.7.1
Created-By: 17.1-b03 (Sun Microsystems Inc.)
Main-Class: com.ymene.Main
Class-Path: .

The "." in Class-Path seems to point on the root of the .jar? I`ve never seen it like that before in any manifest files. So I wonder, if that is the right approach to achieve my wish to not change my java-sourcecode at all, no matter if the resource will be builded within or outside the jar as long as the path will be the same.

Can anyone tell me, if the "." in the manifest.fm file will have any undesired side effects for me? And if that wont be the case, is it possible to generate that Manifest.mf Class-Path entry (the "." i mean) with Ant? Or is there any other solution to achieve that?

Thanks in advance for any help on this topic, ymene

rekire
  • 47,260
  • 30
  • 167
  • 264
crusam
  • 6,140
  • 6
  • 40
  • 68

1 Answers1

4

The single dot means "this directory".

Matten
  • 17,365
  • 2
  • 42
  • 64
  • And "this directory" in this special case means the directory of the manifest.mf file within the .jar? THis would be kinda confusing to me, since the pathes shouldnt work at all then, or is there still a part I am missing? – crusam Feb 04 '11 at 12:42
  • 1
    No, it means the path where the jar file is placed. If you're using libraries in a subdirectory like "lib/", you have to mention every jar in the class-path section of the manifest. – Matten Feb 04 '11 at 12:56