Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there an Java API viewer on command line like man for c and ri for ruby? [closed]

Is there an Java API viewer on command line?

I have been using man for C programming and ri for Ruby programming. Both of them seems very convenient for me, and now I am looking for something alike for Java API.

I apologize if this question has been raised before. I did many Google searches but no result shows up. I think I might have been using the wrong terms.

like image 462
ssgao Avatar asked Feb 04 '13 23:02

ssgao


1 Answers

As part of the JDK, you will also receive the javap utility that allows you to see method signatures in a java .class file.

javap myClass

For java API, you can use

javap java.lang.Integer

If you are a vi fanatic, use this tweak to see the method signature on the class under cursor with the following addition to your ~/.vimrc.

let $jre='/cygdrive/c/jdk1.6.0_21/jre'  
map tt yy:tabnew ^R^W^M  
map + tt:set ft=java^M!!javap -public `grep .*%$ $jre/lib/classlist`^M  
  1. Characters preceeded by caret like ^M need to be typed using Ctrl+V then Ctrl+M
  2. javap needs to be in your system path
  3. Use your own jre location in place of this
  4. Finally, since this is tested using cygwin, you may need to do some touch ups

Another way is to use a text-based browser. See: Look up javadoc Help file from Vim [Unix Only]

like image 131
saalehr Avatar answered Oct 18 '22 07:10

saalehr