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.

Raghav Pandya
  • 131
  • 1
  • 7
  • 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. – Dave Jarvis Sep 15 '20 at 20:47

1 Answers1

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

Ingo Kegel
  • 46,523
  • 10
  • 71
  • 102
  • 2
    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. – Raghav Pandya Jul 25 '16 at 13:58
  • 1
    If the class file is in the package "com.mycorp", you have to add the directory that contains the "com" directory. – Ingo Kegel Jul 25 '16 at 15:41
  • 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! – Raghav Pandya Jul 25 '16 at 17:36
  • 1
    You have to use the heap walker to find out which instances are holding on to selected objects or arrays. – Ingo Kegel Jul 25 '16 at 20:23
  • 1
    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 !!!! – aName Sep 06 '17 at 08:53
  • @aName 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 viewer – Ingo Kegel Sep 06 '17 at 09:17