问题描述
命令行上是否有Java API查看器?
Is there an Java API viewer on command line?
我一直在将 man
用于C编程,并将 ri
用于Ruby编程.两者对我来说似乎都很方便,现在我正在寻找类似 Java API 的东西.
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.
如果这个问题以前有人提出过,我深表歉意.我进行了许多Google搜索,但未显示任何结果.我想我可能使用了错误的术语.
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.
推荐答案
作为JDK的一部分,您还将收到javap实用程序,该实用程序可让您在java .class文件中查看方法签名.
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
对于Java API,您可以使用
For java API, you can use
javap java.lang.Integer
如果您是狂热者,请使用此调整来查看光标所在类上的方法签名,并在〜/.vimrc中添加以下内容.
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
- 插入符开头的字符(如^ M)需要先按Ctrl + V,然后再按Ctrl + M键入
- javap必须位于您的系统路径中
- 使用您自己的jre位置代替
- 最后,由于已使用cygwin进行了测试,因此您可能需要进行一些修饰
另一种方法是使用基于文本的浏览器.看:从Vim查找Javadoc帮助文件[仅限Unix]
Another way is to use a text-based browser. See:Look up javadoc Help file from Vim [Unix Only]
这篇关于命令行上是否有Java API查看器,例如man代表c,ri代表ruby?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!