You cannot use the same binary without recompiling it - this is the point. You have to use a C/C++ compiler for the plattform (For example gcc/g++ or the MSVC compiler)
Take a look at Qt, it is a crossplattform framework, based on C++ - but you have to recompile. In Java you just create Bytecode