在 C# 中分析/反射 jars [英] Analyse/reflect jars in C#
问题描述
我发现了这个问题 .jar to .cs class/文件转换技术或实用程序?这也能解决我的问题.
I found this question .jar to .cs class/file transform technique or utility? which also would solve my problem.
但是由于我应该提供一个工具,它不仅可以生成 C# 代码,而且还可以将其编译为一个 dll,而且这仅在 C# 中很容易做到,是否有任何 .net 库可以用来反映类和存储在 jar 文件中的接口?我只需要方法的签名,而不是调用它.
But since I should provide a tool which not only generates the C#-Code but also compiles it to one dll, and this would be easiear to do only in C#, is there any .net library with which I can reflect Classes and Interfaces which are stored in a jar file? I just need the signatures for the Methods, not to invoke it.
谢谢
推荐答案
您可以使用 javap 命令行实用程序来打印方法签名.使用您熟悉的任何方式从 jar 中提取类:它只是一个 zip 文件.因此,您可以使用 C# API 或命令行实用程序(例如 jar vfx myjar.jar
You can use javap command line utility to print the methods signature. Use any way you familiar with to extract classes from jar: it is just a zip file. So you can either use C# API or command line utility (for example jar vfx myjar.jar
这篇关于在 C# 中分析/反射 jars的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!