I have my Java source code in the standard src/ lib/ test/ directory structure for my project. I want to generate a web view of my source code where I can fire up a browser and see syntax-highlighted, line numbered code. I not only want this but I also want the files to be correctly linked (e.g. clicking on a method/class/interface etc name on the webpage view of the code, it would take me "Eclipse-style" to the relevant page). Is there any piece of software that already does this? I know there is tons of syntax highlight js and css out there so that part is easy and thus I am more interested in the linking part.
-
"... more interested in the linking part." Highlighting keywords is easy. Getting cross-references right means simulating what the compiler does in resolving what a name refers to. That's a lot harder.Ira Baxter– Ira Baxter2011-06-22 04:19:49 +00:00Commented Jun 22, 2011 at 4:19
-
Ira is correct, this could be quite a lot of work. Would producing JavaDocs, with source attached and linked not suffice? Not quite what you described, but maybe close enough?Crollster– Crollster2011-06-22 05:23:48 +00:00Commented Jun 22, 2011 at 5:23
-
@Ira, yes, it is a hard question, else I probably would not be asking :) I would imagine if the bin/ directory is available, we can look at the .class files and the .class files have all the info (they have line numbers too I believe) we need but yes it is hard to do and I don't know any tool that does it.pathikrit– pathikrit2011-06-22 08:40:58 +00:00Commented Jun 22, 2011 at 8:40
-
@Crollster, no it won't suffice - we have an extremely large code base and sometimes it is faster for engineers to just have a simple web view for what's going on than checkout and update millions of lines of code and grep through it or load it in an IDE.pathikrit– pathikrit2011-06-22 08:42:09 +00:00Commented Jun 22, 2011 at 8:42
3 Answers
See our Java Source Code Browser. Combines Java source code browsing with JavaDoc style cross references. Hyperlinks on identifiers follow Java's scoping rules fully.
Presently operates with Java 1.4, now completing versions for Java 1.5 and up.
EDIT May 2012: Handles Java 1.6 and Java 7
4 Comments
I think your best bet would be Cobertura. Out-of-the-box it will generate nice HTML versions of your source. As a side benefit, it will also generate your code coverage report as well. ;)
Maven JXR is another option as well (if you are using Maven).
3 Comments
OpenGrok does much of what you are asking for, also allowing for interesting searches.