Java code - looking for source code

java, jsp, tomcat

Solution

From the perspective of a web application, class or resource loading looks in the following repositories, in this order:

* Bootstrap classes of your JVM
* System class loader classes 
* /WEB-INF/classes of your web application
* /WEB-INF/lib/*.jar of your web application
* $CATALINA_HOME/lib
* $CATALINA_HOME/lib/*.jar

from the Tomcat docs.

The most likely locations for classes specific to your application are the `WEB-INF/lib/*.jar` and `WEB-INF/classes`. However as others have mentioned, this will contain compiled class files and you wont be able to see the exact java source (even after decompiling)

Problem

I have this Java code some other person wrote, specifically JSPs. I am trying to understand where everything is. In my `index.jsp` (the main file which is loaded) it imports a certain namespace (I suppose tomcat does all the compiling, I don't know): ``` <%@ page import="org.sgrp.SearchResults"%> ``` This physical location doesn't exist in my CLASSPATH so I suppose it's referring to a namespace inside the .jar code structure (correct me if I'm wrong). So how am I suppose to find the source code for this? Does Tomcat set a specific CLASSPATH location for each project? EDIT I'm trying to understand if Tomcat follows a certain structure so I can find where the source code for this stuff is.

Original source