How to create JavaDoc documentation for classes without source?

I would like to generate some basic documentation of the html interface (without comments, of course) of class files in a bank to which I have no source. How can i do this?

The old classdoc tool [Class Doc] [1] http://classdoc.sourceforge.net/, which was available for java 1.3 used to provide this service. It seems to me that this can be done with the help of reflection.

Any ideas or examples using javadoc or another utility on how to accomplish this seemingly simple task on 1.6 or 1.7 classes?

+3
source share
2 answers

, , . , java javadoc . jar, - :

ArrayList<Class> classes = new ArrayList<Class>();    
    JarFile jfile = new JarFile("your jar file name");
    String pkgpath = pckgname.replace(".", "/");     
    for (Enumeration<JarEntry> entries = jfile.entries(); entries.hasMoreElements();) {
        JarEntry element = entries.nextElement();     
        if(element.getName().startsWith(pkgpath)
            && element.getName().endsWith(".class")){     
            String fileName = element.getName().substring(pckgname.length() + 1);     
            classes.add(Class.forName(pckgname + "." + fileName .split("\\.")[0]));     
        }     
    }

, , , , jar. , javadoc , .

, javadoc .

, , ...

+1

jar tvf yourjar.jar javap , .

+1

All Articles