Java class files are compiled into generic bytecodes with are platform independent due to which it exceution is slow as compared to language say C with creates machine specific code. Recently with improvements in compiler design Java execution speed has gone up.
The Hotspot technology introduced in J2SE 1.3 enables the runtime system to identify crucial areas of code that are utilized many times, and these are aggressively compiled.
It includes dynamic compilers that adaptively compile Java bytecodes into optimized machine instructions and efficiently manages the Java heap using garbage collectors, optimized for both low pause time and throughput.
Hotspot technology is relatively new, and it's quite likely that future versions of Java will yield further speed-ups. For example, J2SE 5.0 is reportedly 1.2 to 1.5 times faster than its predecessor (Version 1.4).
Hotspot technology has the unfortunate side effect that program execution is often slow at the beginning until the code has been analyzed and compiled.