This week's book giveaway is in the Java in General forum.
We're giving away four copies of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 and have ishori Sharan & Adam L Davis on-line!
See this thread for details.
Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

IntelliJ IDEA Debugging Question

 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

 
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic