If you have the NetBeans Profiler installed, you can use it to profile free-form projects. (See Chapter 15 for more information on installing and using the Net-Beans Profiler.) In order for the Profile Main Project command to work with a free-form project, you must add an Ant target to your project's build.xml file. This Ant target will be very similar to the target you use to run your application, with some additional tasks and parameters. The minimum changes are:
For this example run target <target name="run" description="Runs my Application" depends="compile, init"> <java jar="myApplication.jar" fork="true"> </java> </target> the profiling target would be <target name="profile" description="Profiles my Application" depends="compile, init"> <nbprofiledirect> <classpath> <pathelement location="myApplication.jar"/> </classpath> </nbprofiledirect> <java jar="myApplication.jar" fork="true" jvm="${profiler.info.jvm}"> <jvmarg value="${profiler.info.jvmargs.agent}"/> </java> </target> After you add the target, select Profile | Profile Main Project. The IDE will prompt you for the target that should be used for profiling. |