Umbra Aeternitatis Umbra Aeternitatis - 2 months ago 5x
Java Question

Java list class methods from command line

Is it possible to get a list of methods of the class from command line?

In Eclipse or Intellij IDEA one usually hits

ctrl + space
for autocompletion menu. It's cool, but I wish to get something alike from bash.

E.g. I have a class that extends a class (or classes if the parent also extends a class) and implements a couple of interfaces - so I need to know which methods I'm able to use.

P.S. I use vim 'cause I have memory limitations to use entire IDE.


You can use the java disassembler: javap:


Compile the following DocFooter class:

import java.awt.*;
import java.applet.*;

public class DocFooter extends Applet {
        String date;
        String email;

        public void init() {
                date = getParameter("LAST_UPDATED");
                email = getParameter("EMAIL");

        public void paint(Graphics g) {
                g.drawString(date + " by ",100, 15);

The output from the javap DocFooter.class command yields the following:

Compiled from ""
public class DocFooter extends java.applet.Applet {
  java.lang.String date;
  java.lang.String email;
  public DocFooter();
  public void init();
  public void paint(java.awt.Graphics);