File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes IDEs, Version Control and other tools and the fly likes IntelliJ IDEA Debugging Question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "IntelliJ IDEA Debugging Question" Watch "IntelliJ IDEA Debugging Question" New topic

IntelliJ IDEA Debugging Question

Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15302

I am working on an application and using a 3rd party library. I'm running into issues and I can't tell if it is my code or the 3rd party's code. I have their source code but since I am using their JAR file(s) in my project when I debug I'm not able to see the actual method implementations.

Is there a way to attach source code to a project from an external location just for debugging? So that when I step through I can actually step their their source code as well?

GenRocket - Experts at Building Test Data
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15302

Alright, with a bit of help I managed to figure this out. You go to Project Settings and in the Libraries/Global Libraries section there is an Attach Sources button. Once the sources are attached you set breakpoints on the code by using the project view's tree. Just find the Libraries node, usually right under your module node. Expand it and find the library and you can double click the classes. Since the source code is no linked you get a view of the source code and are able to set breakpoints.
Peter Petrov

Joined: Feb 03, 2006
Posts: 18
Your approach worked for me, thanks for that.

I found your post after doing a google search
for "debug third-party code with Intellij IDEA".

Which version of IntelliJ IDEA are you using?
I am currently working by using Intellij IDEA 7.0.5.

But I was expecting to get that behaviour (which you describe) by
adding the third party sources to the Application Server definition:
-> Click "Run"
-> Click "Edit Configurations"
-> Choose some Tomcat/JBoss server configuration which you already defined in IntelliJ IDEA
-> From the right container, from the server tab choose "Configure"
-> Click "Attach Sources"

So my question is: if my expectation is wrong, what is
the meaning of "Attach Sources" there (where I described) ?

Thanks in advance.

I agree. Here's the link:
subject: IntelliJ IDEA Debugging Question
It's not a secret anymore!