Reputation: 9113
I want to generate the API for all the classes that are there in my Java 1.6 application. It should look like regular Java 1.5 API documentation.
I don't have the source code. I have class files in a jar file.
Upvotes: 18
Views: 32592
Reputation: 1977
You can use the javap
command on any class in your classpath. This will not produce Javadoc files, but it will allow you to see what the class provides.
Ex...
javap java.lang.String
produces the following output
public final class java.lang.String implements java.io.Serializable, java.lang.Comparable<java.lang.String>, java.lang.CharSequence {
public static final java.util.Comparator<java.lang.String> CASE_INSENSITIVE_ORDER;
public java.lang.String();
public java.lang.String(java.lang.String);
public java.lang.String(char[]);
public java.lang.String(char[], int, int);
...and after a bunch of constructors there are other methods...
public int length();
public boolean isEmpty();
public char charAt(int);
public int codePointAt(int);
And you can have it show you other things too, but this is probably the most helpful.
Not exactly what you are looking for, but if you just have a jar with a bunch of classes this might be your best option.
Upvotes: 2
Reputation: 72151
I haven't used it, but this opensource project claims to create docs from java class or jar files:
http://classdoc.sourceforge.net/
Upvotes: 5
Reputation: 15018
Who is changing my question ? I don't have the source code. I have class files in a jar file. Purushotham 47 mins ago
You don't have any source files? Well then you're probably out of luck. There might be some obscure plugin buried in Eclipse's huge database that can do it from class files, but even then you're only going to get method signatures, not any comments.
However, if this is your project that you have written then you can generate JavaDoc in your IDE. For Eclipse do Project > Generate JavaDoc. In NetBeans, right click your project and select Generate JavaDoc.
If you're wanting to include your dependencies, then that's a very bad idea. Always link to your dependencies' JavaDocs, never include it in yours. If not for losing your sanity at seeing a massive wall of classes from Large Overly Framework X, it's just to keep them separate. If I want to read the JavaDoc on your project, I want to read it only on your project, not on slf4j.
Upvotes: 1
Reputation:
You can’t produce Javadoc from jars of class files, not even rudimentary Javadoc. You can only generate Javadoc from source files, because that is where the Javadoc lives.
Upvotes: 19