Reputation: 127
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.
Upvotes: 2
Views: 3076
Reputation: 159106
You can use the java disassembler: javap
:
Example
Compile the following
DocFooter
class:import java.awt.*; import java.applet.*; public class DocFooter extends Applet { String date; String email; public void init() { resize(500,100); date = getParameter("LAST_UPDATED"); email = getParameter("EMAIL"); } public void paint(Graphics g) { g.drawString(date + " by ",100, 15); g.drawString(email,290,15); } }
The output from the
javap DocFooter.class
command yields the following:Compiled from "DocFooter.java" 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); }
Upvotes: 3
Reputation: 14637
While I would advice spending a bit of money on more RAM, you could using ctags instead. I'm not sure if it's up to date with Java 7/8/9 features, but here's a blog describing how to use it: http://andrewradev.com/2011/06/08/vim-and-ctags/
Upvotes: 0