How to compile c++
I'm not sure how you found "javac" and nothing else, as googling for "how to compile c++" find loads of good site, the first three of which are:
How to: Compile a Native C++ Program from the Command Line
http://msdn.microsoft.com/en-us/library/ms235639%28v=vs.80%29.aspx
How to Compile in windows?
http://www.cplusplus.com/forum/beginner/102345/
How to compile a C/C++ program
http://ce.uml.edu/compile.htm
There are also several threads on best compiler and best IDE on this site!
Compiler versus IDE
Note that Code::Blocks isn't a compiler, it's an IDE (Integrated Development Environment)
Code::Blocks uses the GCC compiler set, default, as do a lot of other IDEs. So whether you use Code::Blocks, CodeLite, Geany, ... or even the command line, the compiler is the same, which means that the program will be compiled identically (for the same compiler version and command line switches)
So...
Q1 Do you want to the compiler directly (at the command line) or would you prefer to use an IDE?
Q2 What platform are you using?
Compilers
The GCC compiler is a very good and popular compiler.
If you're using Linux (or Mac, I presume) then you also have the Clang compiler, which has a good reputation.
(Note: that while Clang had better C++11 support than GCC< apprently this is no longer the case: data March 14, 2013
C++11 compiler support shootout: Visual Studio, GCC, Clang, Intel
http://cpprocks.com/c11-compiler-support-shootout-visual-studio-gcc-clang-intel/
If you're using Windows, then you should also consider using Microsoft's Visual C++ Compiler. Unfortunately Clang is not yet fully stable on Windows (last I heard).
Note that Code::Blocks, CodeLite, Geany, ... can be used with all these compilers. It's even possible with Visual Studio, but not so neatly.
Andy