Java is Faster than C++ and C++ Sucks Unbiased Benchmark offers a tip for speed-conscious Java programmers -- always run classes with the server version of the virtual machine:
No one should ever run the client JVM when given the choice. ... Every form of Sun's Java runtime comes with both the "client VM" and the "server VM." Unfortunately, Java applications and applets run by default in the client VM. The Server VM is much faster than the Client VM, but it has the downside of taking around 10% longer to start up, and it uses more memory.