tags:

views:

296

answers:

2

I want to use Java VisualVM to also profile the application even when it is starting. By default, it is set as false.

Is there any way to change the profiling to be enabled by default?

Thanks, Aakash

A: 

I've been playing around a lot with VisualVM today for my own purposes and there doesn't seem to be any way of doing that, unfortunately. You could probably put a Thread.sleep(15000) at the start of your main to get 15 seconds in which to connect to the application and start the profiling.

Stefan Thyberg
+1  A: 

VisualVM does not support this kind of usage. It is used to monitor already running java applications.

If you need to profile the application startup you should use NetBeans Profiler isntead. NetBeans Profiler and VisualVM share the same profiling engine so you can open and analyze the profiling snapshots in VisualVM later on.

JB