Make sure your environment (PATH) is configured to use the version of the JDK that you want to use for compilation. You can verify this by running the following in a shell or shell window where you want to run Maven:
java -version javac -version
Make sure both java and javac point to the correct version. It is possible that you have 1.7 JRE (which does not include the compiler) and 1.6 JDK (including the compiler), and the wrong one is used.
Adjust the JAVA_HOME and PATH environment variables as necessary.
Just noticed that you are on CentOS - it is possible that java and javac point to different versions. Use the alternatives command to verify this, see here an example: http://wiki.centos.org/HowTos/JavaRuntimeEnvironment - you will need to check both java and the javac command.
source share