Java has many advantages over C++, for example, there is one graphics library that fits everything: OpenGL. We don't need to make any platform-specific code. Java is running on a virtual machine, which is written in machine code, which means that it is as close to bytecode as any other language.
For people who say that C++ is faster. You are right and wrong. You are right because it is a native language to all OS's and it is used everywhere, therefore everyone knows the most efficient ways to achieve a result. You are wrong, because I have run more than 50 tests with different tasks and in more than half the tasks a Java implementation was faster.