Appears to be a duplicate of https://askubuntu.com/questions/21131/how-to-correctly-remove-openjdk-and-jre-and-set-the-system-use-only-and-only-sun#answer-21137 assuming that you are using Ubuntu.
The key is to use the command sudo update-java-alternatives -s java-6-sun
. Any commands that rely on javac
will be affected and not just Maven.