In the old Unix world, a huge toolset was used to trace, optimize, analyze the software behavior.
With Java, you might easily use the wrong implementation of an API thus getting lousy performance. Or you might just write crappy/unadapted/inefficient code (What?).
Sun's JVM's offer a way to track performance bottlenecks in various ways, with the java option HPROF. Some examples :
Before :

   java MyJavaProg

After :

   java -Xrunhprof:cpu=samples,depth=15,file=trace.log MyJavaProg

The JVM hprof command supports different options, depending on the java version you have. Check which one you have with :

   java -Xrunhprof:help

On my machine (Java 1.4.2, i know...) :

The hidden part of the Iceberg?