Distribution Manifest.mf 中的单个点 (“.”) 是什么意思?
最近我对 Manifest.mf 文件中的类路径有点困惑。所以我想要的是将一些properties.files从我的distribution.jar中外包出来,并将它们放在它旁边,而不更改java-source-files。
以下示例: 此时我可以打开这样的属性文件:
this.getClass().getClassLoader().getRessourceAsStream( "/config/jdbc.properties" );
jdbc.properties 位于名为“resources”的 eclipse 源文件夹中,其中包含一个名为“config”的包。现在,当我构建发行版时,我将它们外包到 distribution.jar 旁边的文件夹中,但如果不更改显示的源代码,我仍然无法找到它们。
到目前为止唯一有效的通用解决方案(没有绝对路径)是以下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: .
“。” Class-Path 中似乎指向 .jar 的根目录?我以前从未在任何清单文件中见过这样的情况。所以我想知道,这是否是实现我完全不更改 java 源代码的愿望的正确方法,无论资源是在 jar 内部还是外部构建,只要路径相同即可。
谁能告诉我,如果“。”在manifest.fm文件中会对我产生任何不良的副作用吗?如果情况并非如此,是否可以使用 Ant 生成 Manifest.mf 类路径条目(我的意思是“.”)?或者还有其他解决方案可以实现这一目标吗?
预先感谢您对此主题的任何帮助, 伊梅内
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
单点表示“此目录”。
The single dot means "this directory".