See this blog
To install/ register a JVM use the following
/usr/sbin/alternatives --install "/usr/bin/java" "java" "/usr/java/default/bin/java" 2
/usr/sbin/alternatives --install "/usr/bin/javac" "javac" "/usr/java/default/bin/javac" 2
And to configure systemwide changes use
/usr/sbin/alternatives --configure java
/usr/sbin/alternatives --configure javac