Distribution Manifest.mf中的单个点(“.")是什么意思? [英] What does a single Dot (".") in Distribution Manifest.mf mean?

查看:105
本文介绍了Distribution Manifest.mf中的单个点(“.")是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近,我对Manifest.mf文件中的类路径有些困惑.因此,我想要从我的distribution.jar中外包一些properties.files,并将它们放在旁边,而无需更改java-source-files.

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" );

jdbc.properties位于名为"resources"的日食源文件夹中,带有名为"config"的包.现在,当我构建发行版时,我将它们外包到位于distribution.jar旁边的文件夹中,但是我仍然会在不更改显示源代码的情况下找到它们.

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.

以下manifest.mf是唯一有效的generell解决方案(没有绝对途径):

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: .

."在类路径中似乎指向.jar的根?我以前从未在任何清单文件中看到过这样的内容.因此,我想知道,这是否是实现我的愿望而根本不更改Java源代码的正确方法,无论资源是在jar的内部还是外部构建,只要路径相同即可.

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.

任何人都可以告诉我,如果." manifest.fm文件中的文件对我会有任何不良影响吗?如果不是这种情况,是否可以用Ant生成Manifest.mf类路径条目(我的意思是.")?还是有其他解决方案可以实现?

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

推荐答案

单点表示此目录".

这篇关于Distribution Manifest.mf中的单个点(“.")是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆