How To View Source/Set Breakpoints In J2EE JDK Files

When debugging Java code I find it useful to be able to browse to, view and debug the J2SE code (e.g., StringBuilder.java).  This is easily done by downloading the source code jar from Sun/Oracle and attaching it to the JDK in IntelliJ.  I would like to be able to do the same for J2EE JDK files (e.g., HttpServlet, ServletRequest, etc.).  However, for J2EE applications, this appears to be a bit more complicated as I've read that the J2EE JDK files are defined by the container (Resin in my case).  In addition, by default, IntelliJ includes the javaee.jar in the classpath so that applications compile.  So I'm a bit confused as to how debugging works in this situation.  Is it possible to get the source code for IntelliJ's javaee.jar and use this for debugging?  Or is javaee.jar only used for compilation and the container's implementation used when debugging?

I have been able to debug J2EE JDK files by manually adding the Resin's version of the J2EE source and class jars to the module dependency list and moving them above the javaee.jar (so they are earlier in the classpath).  Is this the correct way to get this to work?  If so, should I also remove javaee.jar from the dependency list?

Thanks in advance.

Please sign in to leave a comment.