Enamul Hassan
Enamul Hassan

Reputation: 5445

how to see javadoc using command line

In WINDOWS platform, using command line (cmd), I can see the methods belong to a specific package. Say, I want to see the members of Random class. I can see them entering the following command:

javap -p java.util.Random

But, how to see the documentation belongs to each of its members/methods? More specifically:

Is there anyway to see the javadoc from cmd? if yes, what is it? if no, how could you be sure?

Upvotes: 1

Views: 2951

Answers (3)

Secureportail School
Secureportail School

Reputation: 11

The direct answer to your post, is to use "lynx, links", cli web browser to load the javadoc html pages.

  1. For a full cli development (offline or online),
  2. From your favorite shell, I suggest using "gnu-screen" to be able to switch between multiple terminals that offer the function of a DEC VT100 terminal. There is a scrollback history buffer for each virtual terminal and a copy-and-paste mechanism that allows moving text
  3. regions between windows.
  4. In one of the terminal, I compile and run using "javac, java or jdb(javadebug)".
  5. For example, javac -cp ~/java/jnetpcap.jar:.:$HOME/lib FGjnetPcapFile.java ; java -cp ~/java/jnetpcap.jar:.:$HOME/lib FGjnetPcapFile ; jdb -classpath ~/java/jnetpcap.jar:.: $HOME/lib FGjnetPcapFile
  6. In a second terminal, I use "lynx" to view the java documentation. Note that the "javadoc" tool creates html format documentation.
  7. It is not used to view the documentation unlike perldoc.
  8. The java documentation can be part of the jre, the jdk or even downloaded as a javadoc-xxx.jar file. In jre and jdk, it is already uncompressed and stored on disk as html files. ex: /usr/share/doc/openjdk-7-jre-headless/jdk/api/javadoc/doclet/index-all.html
  9. In case of a javadoc-xxx.jar file, you can unzip the file with "unzip", then use "lynx" to access the html files extracted.
  10. In the third terminal, I use "vim" to create or modify the code.
  11. Finally, in a fourth terminal, I use "svn" as a code revision control, and vimdiff as visual comparison tool.

I also plan to use gnuit "Gnu Interactive tools"

Upvotes: 1

user5170863
user5170863

Reputation:

Is there anyway to see the javadoc from cmd?

No, there is no easy way to see Javadoc from cmd.

if no, how could you be sure?

Because, it needs internet connection and Javadoc is loaded from corresponding server. On the other hand, member classes are accessed from .class file. That means this service is available if you don't have internet connection. But Javadoc is impossible without internet connection.

Upvotes: 1

user4668606
user4668606

Reputation:

Not at all. And most certainly not with javap. As the documentation says (it's the title to be more precise):

javap - The Java Class File Disassembler

Or in other words: javap doesn't load any docs, it disassembles the .class file containing the specified class. Apart from that it wouldn't make any sense to include a commandlinetool for showing the docs. It's not practical and the docs already exist online.

Upvotes: 2

Related Questions