Attach source code to Jprofiler
Asked Answered
W

1

8

I am new to using JProfiler. I am profiling remotely on an application. When iI click on show source for any object, it says "Source file could not be found in source path" as there are only binaries on remote machine. Is there someway I can link the source code. FYI, I have access to code which i can make use of.

Wolgast answered 22/7, 2016 at 14:56 Comment(1)
Note that you may have to configure the source path while the JProfiler is actively analyzing a running application. Setting the source path while viewing a snapshot may not work.Eastnortheast
E
6

In JProfiler's main menu, select "Session->Session Settings" (while the session is running). On the "Application settings" tab, select the "Source path" radio button and add your source roots to the list on the right side.

enter image description here

Elata answered 23/7, 2016 at 9:2 Comment(6)
I did try the above option but still i get the same message: " Source file could not be found in the source path ". Some how the source path is not getting resolved.Wolgast
If the class file is in the package "com.mycorp", you have to add the directory that contains the "com" directory.Elata
Thanks a lot. It did resolve the path. I have one more question: For instances like char[ ] or java.util.hashmap[ ], how to track which class in the application is creating the problem as directly clicking on View Source will not work for these instances. Should i check the class which from which these instances get generated in the allocation tree or graph? Kindly advise, i am stuck on this and could not find any relevant information in the User Guide or internet!Wolgast
You have to use the heap walker to find out which instances are holding on to selected objects or arrays.Elata
It works also for me, but I wonder if there is a better way to do this, because in my case I have an app with multiple modules, so I guess that I have to add the source path of each module !!!!Bucksaw
@Bucksaw Use an IDE integration or open a snapshot from within the IDE, then you get automatic source navigation into the IDE which is much better than the built-in source code viewerElata

© 2022 - 2024 — McMap. All rights reserved.