简体   繁体   English

是否可以使用Java检索程序集版本(DLL)?

[英]Is it possible to use Java to retrieve assembly version(DLL)?

I recently pickup Java so I have very limited knowledge, but I would like to know if it's possible to get DLL version using Java. 我最近学习Java,所以我的知识非常有限,但是我想知道是否有可能使用Java获得DLL版本。 If it is not possible, is it possible to use C# to get Jar version through the manifest file? 如果不可能,是否可以使用C#通过清单文件获取Jar版本?

It's certainly possible in each case - you just need to write code to read the appropriate file format. 在每种情况下当然都有可能 -您只需要编写代码即可读取适当的文件格式。

I suspect it's vastly simpler to find the manifest in a jar file from C# than the assembly version from Java though - it's just a case of loading a zip file and finding the META-INF/MANIFEST.MF file. 我怀疑从C#中的jar文件中查找清单要比从Java中的程序集版本中查找清单简单得多-这只是加载zip文件并找到META-INF/MANIFEST.MF文件的情况。 Reading the file is easy, as it's plain text. 读取文件很容易,因为它是纯文本。

Depending on exactly what you mean by the version of a DLL, you may need to do all manner of things - if you're talking about .NET assembly attributes, I don't know whether they're placed in some easily-fetchable place; 根据DLL版本的确切含义,您可能需要做各种各样的事情-如果您在谈论.NET程序集属性,我不知道它们是否放置在某些易于获取的位置; my experience of parsing Portable Executable (PE) files is that it's slightly tricky unless you've got library support. 我对可移植可执行(PE)文件进行解析的经验是,除非您有库支持,否则它会有些棘手。 Of course if you can find a Java library which knows the format already, it may become trivial... 当然,如果您可以找到一个已经知道格式的Java库,它可能就变得微不足道了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM