获得在C#中可用的功能/ java包的方法 [英] Get the available functions/methods of java package in C#

查看:204
本文介绍了获得在C#中可用的功能/ java包的方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道这是有可能得到从C#中的java包中可用的类,函数/方法。假设我有一个包含SampleClass一个Java包页。我想从C#检查这个包,这样我可以得到SampleClass。我不想使用这个类在C#其实我只是想获得可用的类和函数的名称。

I want to know that is it possible to get the classes, functions/methods available in a java package from C#. Suppose I have a java package p which contains SampleClass. I want to inspect this package from C# so that I can get SampleClass. I do not want to use this class in C# in fact I just want to get the name of the available classes and functions.

希望这是可能的!

感谢

推荐答案

假设你已经安装了JDK,你可以使用'罐子-tf jarName.jar得到的类,然后你就可以分析列表。

Assuming that you have a JDK installed, you can use 'jar -tf jarName.jar' to get a list of classes, which you can then parse.

要获取有关特定类的更多信息,你可以使用命令行javap的实用打印出的所有方法和字段列表。这是一个相当容易解析的格式。例如:

To get more information about a particular class, you can use the command-line 'javap' utility to print out a list of all methods and fields. This is in a fairly easily parsable format. For example:

javap -classpath . com.prosc.io.ZipCreator
Compiled from "ZipCreator.java"
public class com.prosc.io.ZipCreator extends java.lang.Object{
    public com.prosc.io.ZipCreator();
    public java.lang.Integer getLevel();
    public void setLevel(java.lang.Integer);
    public void createZip(java.io.File, java.io.File)       throws java.io.IOException;
    public void createZip(java.io.File, java.util.zip.ZipOutputStream)       throws java.io.IOException;
    public void setMaximumZipSize(long);
    static {};
}

这篇关于获得在C#中可用的功能/ java包的方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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