Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java source code display in a browser?

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.

like image 962
pathikrit Avatar asked Jun 22 '11 01:06

pathikrit


People also ask

How do I view Java code in Chrome?

Edge/Internet Explorer: CTRL + U. Or right click and select “View Source.” Chrome: CTRL + U.

Does Java have source code?

The source code file has file extension ". java". This is the file that is converted into the Java bytecode file, also called the class file. Everything that you physically code is "source code".

How do I code Java in HTML?

Nowadays, the best way to add Java to HTML is through the so-called JavaServer Pages (JSPs). A JSP page is a file with the extension . jsp. It is an HTML markup containing several JSP tags.


2 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

like image 126
Ira Baxter Avatar answered Sep 22 '22 16:09

Ira Baxter


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).

like image 41
Will Iverson Avatar answered Sep 26 '22 16:09

Will Iverson