Version 3
Visibility: Open to anyone
    1. Download both Java7 & Java8 and put them on different folders  $JAVA_7 & $JAVA_8
    2. Include both versions on update-alternatives for java
      1. sudo update-alternatives --install "/usr/bin/java" "java" $JAVA_7/bin/java 2
      2. sudo update-alternatives --install "/usr/bin/java" "java" $JAVA_8/bin/java 1
    3. Include both versions on update-alternatives for java2
      1. sudo update-alternatives --install "/usr/bin/javac" "javac" $JAVA_7/bin/javac 2
      2. sudo update-alternatives --install "/usr/bin/javac" "javac" $JAVA_8/bin/javac 2

     

     

    • For Changing default java :
      • sudo update-alternatives --config java
      • sudo update-alternatives --config javac