Install java-7-oracle with PPA on Ubuntu

This note is based on Howto- Install Oracle Java7 in Ubuntu12.04 Precise Pangolin | PPA. The download procedure in oracle-java7-installer package is broken. We should modify it for the rest automatically installation. The summary of my steps are listing:

1. Purge installed JDKs:
# apt-get purge openjdk* sun-java6*

2. Add repository for installation:

# add-apt-repository ppa:eugenesan/java
# apt-get update

3. Modify the installation procedure:
# vim /var/lib/dpkg/info/oracle-java7-installer.postinst
Comment out lines 103-106 which refers to download JDK. The contents may seems like:

WGETRC=wgetrc wget $PARTNER_URL \
|| fp_exit_with_error “download failed”
rm -f wgetrc

4. Manual download JDK source and move it into installation directory:
# mv {source} /var/cache/oracle-java7-installer/
The type (x86/x64) and name of the source can be found within the directory (if you had try to install). Eg: jdk-7u3-linux-x64.tar.gz.

5. Resume the installation:
# apt-get install oracle-java7-installer
All things done. Happy enjoy. 🙂