Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to step into code from jars (non JDK) using IntelliJ?

I am new to IntelliJ (and Stackoverflow) and fairly new to Java,In my application I am using code from jars that in IntelliJ I added as "External Libraries". I also have the source code for those jars, but I rather not compile it (they are huge and complex). Now while debugging my application I would like to step into the library code that is compiled into those jars. How can I set up IntelliJ to do that? Is there another way other that attaching the entire jar library source code to my application code?

like image 363
Ascari Avatar asked Mar 20 '10 23:03

Ascari


People also ask

How do I step through code in IntelliJ?

Force step overFrom the main menu, select Run | Force Step Over or press Alt+Shift+F8 .

Can we open jar file in IntelliJ?

From the File menu just choose Project structure. 3) Then go to Libraries on the left side. Then click the + sign (add new library). Then locate your JAR and select it, this will import it as a library.


2 Answers

You can attach source code to the library configuration. In the Project Structure dialog where you define which JARs make up which libraries, there is an "Attach Sources..." button that allows you to specify one or more source JARs, ZIPs or directories.

like image 92
Dan Dyer Avatar answered Sep 30 '22 16:09

Dan Dyer


There is another way.If you are in code editor and you are using classes of particular jar, you can CTRL+click on a particular class or method. It will navigate you to compiled code. There will be a tab on top with link "Attach Sources..". There you can specify source.

like image 30
dnsh Avatar answered Sep 30 '22 16:09

dnsh