This package provides functions that read a java class name from the Emacs minibuffer, defaulting to the name around point, and ask a World-Wide Web browser to load its document. The package is similar to jde-help-symbol of JDEE, but it was written when JDEE had little support for browsing documents and has been developed separately since then. Although jde-help-symbol is more powerful, the package still has several good points:

You can use this package with JDEE, with java-mode defined in cc-mode, or independently. Here is a screenshot.



Current release is tested for the following softwares/documents.

The version of w3m is critical: java-help highly depends on this specific w3m, and may not work with other versions.


Simply type the following and enter class name. The default class name is the name around the current point.

M-x java-help-open

Note there might be the same class names in different packages. For example, there are two Locale classes in JDK and Java3D documents. You can designate the target class more specifically by using (partial) package names that can also include regular expressions:

util.Locale      -> JDK's Locale
javax.*Locale    -> Java3D's Locale

java-help-browse-url-w3m specific: if you set java-help-browser-function to java-help-browse-url-w3m, you can show its last page by specifying an empty class name.

Customization (.emacs)

Add the following to invoke java-help-open by M-?, and change java-help-open-dir-list appropriately.

(global-set-key "\M-?" 'java-help-open)
(autoload 'java-help-open "java-help")
(setq java-help-open-dir-list '("/home/maru/doc/jdk/docs/api" "/home/maru/doc/j3d"))

Set java-help-browser-function as follows if you want to use java-help-browse-url-w3m,

(setq java-help-browser-function 'java-help-browse-url-w3m)

or if you want to use emacs-w3m,

(setq java-help-browser-function 'w3m)

where the default is browse-url-browser-function. You may also use `M-x customize-group java-help' for customizing these variables.

Key Bindings (java-help-browse-url-w3m)

Here are default key bindings in the w3m mode.

key             binding
---             -------

p               java-help-browse-url-w3m-move-to-previous-entry
n               java-help-browse-url-w3m-move-to-next-entry
/               java-help-browse-url-w3m-search-method
.               scroll-down
,               scroll-up
m               recenter
;               forward-char
l               java-help-browse-url-w3m-previous-line1
k               java-help-browse-url-w3m-next-line1
j               backward-char
o               java-help-browse-url-w3m-scroll-down1
i               java-help-browse-url-w3m-scroll-up1
DEL             java-help-browse-url-w3m-history-previous
backspace       java-help-browse-url-w3m-history-previous
delete          java-help-browse-url-w3m-history-previous
SPC             java-help-browse-url-w3m-history-next
RET             java-help-browse-url-w3m-follow-anchor
TAB             java-help-browse-url-w3m-next-anchor
u               java-help-browse-url-w3m-next-anchor
Q               java-help-browse-url-w3m-quit-and-kill
q               java-help-browse-url-w3m-quit

You can understand most of these functions' behaviors by invoking them. The following is an example for java-help-browse-url-w3m-search-method, the only one function that might be a bit hard to understand.

In the buffer for java.util.Locale, suppose that the current cursor position is at the top of the line `... boolean | equals(Object obj) ...'

| Method Summary                                                                          |
|        Object | clone()                                                                 |
|               |           Overrides Cloneable                                           |
|       boolean | equals(Object obj)                                                      |
|               |           Returns true if this Locale is equal to another object.       |
| static Locale | getAvailableLocales()                                                   |
|            [] |           Returns a list of all installed locales.                      |

Then, the buffer's image changes to the following by pushing `/' and the cursor is moved to the top of the line `equals'. You can go back to the table by pushing `/' again.



public boolean equals(Object obj)

    Returns true if this Locale is equal to another object. A Locale is deemed equal to
    another Locale with identical language, country, and variant, and unequal to all other
        equals in class Object

        true if this Locale is equal to the specified object.




Koji Nakamaru