The best way to solve this problem without changing your application is to not use VisualVM at all. As for the other free options, you can use Eclipse TPTP or Netbeans profiler or something else with your IDE.
If you can change your application to pause it when configuring the profiler in VisualVM, it is quite possible to do this using the VisualVM Eclipse plugin. I am not sure why you are getting a NullPointerException, as it works on my workstation. You need to configure the plugin by specifying the jvisualvm binary path and the JDK path; this is done by visiting the VisualVM configuration dialog in Windows β Settings β Run / Debug β Start β VisualVM Setup (as shown in the following screenshot).

You also need to configure the application to start using the VisualVM launcher instead of starting the default JDT.
All application launches from Eclipse now cause VisualVM to automatically track the new local JVM, provided that VisualVM is already running. If you do not have VisualVM running, the plugin will start VisualVM, but it will also continue to work with the application.
The conclusion from the previous sentence, it is obvious that using the application in the main() method before performing any processing is very useful. But this is not the main reason for the suspension of the application. Apparently, VisualVM or its Eclipse plug-in does not automatically run processor or memory profilers. This would mean that these profilers would need to be started manually, which would require the application to pause.
In addition, it is worth noting that adding the flags: -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y to start the JVM will not help you, in the case of VisualVM, pause the application and configure the profilers. Flags are designed to help you with profilers who can actually connect to the open JVM port using the JDWP protocol. VisualVM does not use this protocol, so you will need to connect to the application using JDB or a remote debugger; but this will not solve the problem associated with the profiler configuration, since VisualVM (at least with updates for Java 6 26) does not allow you to configure profilers on a paused process, because it just does not display the Profiler tab.
Vineet Reynolds Aug 17 2018-11-11T00: 00Z
source share