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 wo开发者_C百科rked 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
The single dot means "this directory".
精彩评论