开发者

Getting list of all variables in Eclipse

Is there a way to copy text into buffer all the variab开发者_开发知识库les local and inherited for a particular class?


I would recommend using an external tool like javap to quickly list all instance variables of a class (in the stdout, which you can easily copy).

The javap command disassembles a class file.
Its output depends on the options used.
If no options are used, javap prints out the package, protected, and public fields and methods of the classes passed to it. javap prints its output to stdout.

You can call it as an external tool from your eclipse session:

  • Run>External Tools. This brings up the external tool launch wizard.
  • Select Program, and give a name, "javap".
  • For "Location:", hit the browser file system, and find where your javap app is located.
  • For "Working Directory", select "Browse Workspace...", and choose your workspace where your class file is located.
    For example, I have a project in my workspace called helloDB, after I selected this project, the test box will update to: ${workspace_loc:/helloDB}.
    I don't think javap uses this directly, but you can use it for the "Arguments:" section.
  • My helloDB.class file is located in my bin directory relative to my project.
    So for "Arguments:", so for my project I entered: -classpath ${workspace_loc:/helloDB}/bin helloDB
    Note: there's a space between .../bin and helloDB. The helloDB is my .class file.
  • Hit run
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜