Thursday, January 03, 2008

Profiling Maven 2 Apps in Netbeans 6

I thought this might be more complicated. It wasn't. To use the Netbeans profiler with your Maven 2 project you simply need to add a single pair of parameters when running your java app. Call up the project's Properties dialogue, select the "Run" tab and add something like the following to the jvm args:

-agentpath:"C:\Program Files\NetBeans 6.0\profiler2\lib\deployed\jdk15\windows\profilerinterface.dll=\"C:\\\"Program Files\"\\\"NetBeans 6.0\"\\profiler2\\lib\\"",5140

This meant that now when I ran my app (F6) execution would wait for me to attach the profiler. Cue real time graphy goodness. Sweet.

5 comments:

Anonymous said...

Nice
Regards,
Joseph
http://db2examples.googlepages.com/

calyen said...

Thanks for the tip,
Can you elaborate how to set this option ?

Is it in the Actions tab of maven project properties ?

I'm using ubuntu, is this the right config line ?

-agentpath:"/usr/local/netbeans-6.1beta/profiler3/lib/deployed/jdk15/linux/profilerinterface.so=/usr/local/netbeans-6.1beta/profiler3/lib",5140

Thanks
Kalyan

Andrew Law said...

Hi caylen. Nearly. You're right its the maven project properties dialog (right click the maven project > Project Properties) Then select the "Run" category.

HTH

Anonymous said...

Good one - thanks.

Also, it's useful to save that as a custom config in the properties then you can easily switch between profiled and default Run args

Anonymous said...

Hi,

My name is Varun Nischal and I'm the NetBeans Community Docs Contribution Coordinator. Your blog entry would make a fantastic tips and Tricks for our Community Docs wiki (http://wiki.netbeans.org/CommunityDocs).

Would you be willing to contribute it? If you need any help or have any questions, please contact me at nvarun@netbeans.org

I look forward to hearing from you.

Thanks,
Varun Nischal
http://nb-community-docs.blogspot.com/
--
"You must do the things you think you cannot do."