java7.sh 559 B

1234567891011121314151617181920
  1. #!/bin/bash
  2. JAVA=$IROOT/java7
  3. RETCODE=$(fw_exists ${JAVA}.installed)
  4. [ ! "$RETCODE" == 0 ] || { \
  5. # Load environment variables
  6. source $JAVA.installed
  7. return 0; }
  8. # First remove java6
  9. sudo apt-get remove -y --purge openjdk-6-jre openjdk-6-jre-headless
  10. # Then install java7
  11. sudo apt-get install -y openjdk-7-jdk
  12. # Setup environment variables
  13. JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-`dpkg --print-architecture`
  14. echo "export JAVA_HOME=${JAVA_HOME}" > $JAVA.installed
  15. echo "export PATH=${JAVA_HOME}/bin:$PATH" >> $JAVA.installed
  16. source $JAVA.installed