A quick way to install Java Oracle on Ubuntu

    Hello, Habrovsk citizens!
    There is enough information on the net to install Java Oracle. But, in my opinion, the method described below is the most convenient. The reason for convenience is that you do not need to go to the Oracle website, register and download the installation file, and at the same time there is no need to store it somewhere locally.
    The installation process boils down to running a single script.

    Version="x64" # или i586
    wget --progress=bar --no-cookies --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F" "${JDK_URL}"
    chmod +x jdk-6u32-linux-$Version.bin 
    yes | ./jdk-6u32-linux-$Version.bin
    mkdir -p /usr/lib/jvm/
    mv jdk1.6.0_32 /usr/lib/jvm/
    for binary in $(ls /usr/lib/jvm/jdk1.6.0_32/bin/j*); do
      name=$(basename $binary)
      update-alternatives --install /usr/bin/${name} ${name} ${binary} 1
      update-alternatives --set ${name} ${binary}
    rm "jdk-6u32-linux-$Version.bin"

    If you need a 32-bit version, you just need to replace the value of the Version variable from x64 to i586 in the script.
    I hope the script will be useful.

    Also popular now: