Updating to Java 8

Discussion in 'Systems Administration' started by Chearful, Sep 20, 2015.

  1. Hi, I'm currently using Ubuntu 14.04 on my VPS, and on Java 7. A plugin I'd like to use is done in Java 8, therefore I need to update it. I've tried googling stuff etc, but no luck. Can someone tell me the command(s) to update my Java?
     
  2. Run this:
    sudo add-apt-repository ppa:webupd8team/java
    sudo apt-get update
    sudo apt-get install oracle-java8-installer
     
    • Winner Winner x 1
  3. Source:
    https://extravm.com/billing/knowledgebase/17/Install-Java-8-JDK-on-CentOS-single-command.html

    Install Java 8 JDK on CentOS (single command)
    If you run applications that require Java typically you need to install a separate repo or build from source, but with this you can easily install Java 8 JDK with a single commnad.

    wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u40-b26/jdk-8u40-linux-x64.rpm"

    rpm -Uvh jdk*

    That's it! Type java -version to verify that it is installed.
     
  4. MikeA

    MikeA Retired Moderator
    Retired Benefactor

  5. minecraft7net

    Supporter


    # this is for debian ! not ubuntu dont use debian repos use ubuntu :)


    #apt-cache search java8
    openjdk-8-jdk - OpenJDK Development Kit (JDK)
    openjdk-8-jre - OpenJDK Java runtime, using Hotspot JIT
    openjdk-8-jre-headless - OpenJDK Java runtime, using Hotspot JIT (headless)

    but before check you repos

    cat /etc/apt/sources.list

    you need something like this (i'm using testing change your debian version for stable/testing etc).

    deb http://ftp.se.debian.org/debian/ stretch main contrib non-free
    deb-src http://ftp.se.debian.org/debian/ stretch main contrib non-free

    update package info by : apt-get update

    and apt-get install openjdk-8-jre or apt-get install openjdk-8-jre


    and if you need java from oracle you can get it from here.

    http://www.oracle.com/technetwork/java/javase/downloads/index.html

    use jdk server edition for example tgz.

    mkdir -p /opt/java; cd /opt/java
    tar -zxvf jdk-8u60-linux-x64.tar.gz

    and you can use /opt/java/jdk1.8.0_60/bin/java
     
    #5 minecraft7net, Sep 20, 2015
    Last edited: Sep 20, 2015
  6. I'm getting "sudo: add-apt-repository: command not found" on the first command.
     
  7. MikeA

    MikeA Retired Moderator
    Retired Benefactor

    sudo apt-get install software-properties-common
     
    • Like Like x 1
  8. Code (Text):
    [email protected]:~# sudo add-apt-repository ppa:webupd8team/java
    Oracle Java (JDK) Installer (automatically downloads and installs Oracle JDK7 / JDK8 / JDK9). There are no actual Java files in this PPA.

    More info (and Ubuntu installation instructions):
    - for Oracle Java 7: http://www.webupd8.org/2012/01/install-oracle-java-jdk-7-in-ubuntu-via.html
    - for Oracle Java 8: http://www.webupd8.org/2012/09/install-oracle-java-8-in-ubuntu-via-ppa.html

    Debian installation instructions:
    - Oracle Java 7: http://www.webupd8.org/2012/06/how-to-install-oracle-java-7-in-debian.html
    - Oracle Java 8: http://www.webupd8.org/2014/03/how-to-install-oracle-java-8-in-debian.html

    Important!!! For now, you should continue to use Java 8 because Oracle Java 9 is available as an early access release (it should be released in 2016)! You should only use Oracle Java 9 if you explicitly need it, because it may contain bugs and it might not include the latest security patches! Also, some Java options were removed in JDK9, so you may encounter issues with various Java apps. More information and installation instructions (Ubuntu / Linux Mint / Debian): http://www.webupd8.org/2015/02/install-oracle-java-9-in-ubuntu-linux.html
    More info: https://launchpad.net/~webupd8team/+archive/ubuntu/java
    Press [ENTER] to continue or ctrl-c to cancel adding it
    ^CTraceback (most recent call last):
      File "/usr/bin/add-apt-repository", line 139, in <module>
        sys.stdin.readline()
    KeyboardInterrupt
     
    I think that means it is installing Java 9?
     
  9. Oh right, uhh... I don't know...
    Maybe @MikeA does.
     
  10. MikeA

    MikeA Retired Moderator
    Retired Benefactor

    No clue, a few months ago I never got those errors but now none of them work for me. I never use Ubuntu, so dunno.
     
  11. The ppa:webupd8team/java repo includes JDK7,8, and now 9

    Running "sudo add-apt-repository ppa:webupd8team/java" just installs the repo and not JDK you still have to run "sudo apt-get install oracle-java8-installer" to install JDK8, that message is just webupd8team(Oracle) letting you know "Hey JDK9 is in this repo you can install it but it's not recommend unless you know what you doing cause it not production ready yet" so to say.

    Run the commands in this order and it will install JDK8
    Code (Text):

    sudo add-apt-repository ppa:webupd8team/java
    sudo apt-get update
    sudo apt-get install oracle-java8-installer
     
     
    • Winner Winner x 1
  12. Think it's updated. Thank you all for your help. I'd like to leave this open though, in case I encounter any other issues.