An Oracle blog about NetBeans Profiler

Profile Javac!

Two weeks ago Sun Microsystems announced opensourcing href="http://openjdk.dev.java.net/">key Java implementations including javac, the Java programming language compiler. You
can get the javac source code also from netbeans.org with a detailed
tutorial to getting, building, and running the javac sources
in NetBeans IDE.

Since the javac sources are available as NetBeans project inside the IDE, you can easily build and run the compiler as well
as investigate how things work inside. For this the Profiler can be also useful showing you the stack traces and other
information about compiler's runtime. Just follow these five simple steps to check out how easy is now to profile javac.

  1. Download and install NetBeans IDE 5.5 and href="http://profiler.netbeans.org/download/index.html">NetBeans Profiler 5.5.
  2. Follow these instructions to download javac source code
    and open it as a project in the IDE.
  3. Create sample J2SE project in the IDE using New Project wizard: category Samples/General, project Anagram Game. For the
    following instructions the project is expected to be located in C:\\AnagramGame.
  4. Edit the javac buildscript build.xml: append href="http://profiler.netbeans.org/blog/txt/javacProfile/target.txt">target profile for example below target
  5. Set javac project as the Main project and invoke the Profile Main Project action. Choose Java platform for profiling
    (most likely the Default one) and select the profiling task you want to use. After clicking the Run button the Profiler asks
    you to select the ant target for profiling - choose profile in the combo and click OK.

That's all - now you are profiling compilation of Anagram Game by the javac!

Note: The above scenario is for Windows and Anagram Game project. If you want to profile compilation of other project/application on other operating system, you need to modify (some of) following target properties:

  • app.dir: root directory of profiled project/application
  • app.mainclassfile: relative path to mainclass java file of profiled project/application
  • app.srcdir: relative path to profiled project/application source root
  • app.builddir: relative path to profiled project/application compiled classes root

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.