Bopha
Bopha

Reputation: 3426

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. If it is not possible, is it possible to use C# to get Jar version through the manifest file?

Upvotes: 1

Views: 1282

Answers (1)

Jon Skeet
Jon Skeet

Reputation: 1502216

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. 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; my experience of parsing Portable Executable (PE) files is that it's slightly tricky unless you've got library support. Of course if you can find a Java library which knows the format already, it may become trivial...

Upvotes: 2

Related Questions