Page 1 of 1

[SOLVED] How to update Java on Raspbian

Posted: Thu Jan 17, 2019 7:32 am
by M1dn1ghtN1nj4
So I've tried about every guide I could find online, and they all end up going nowhere. They all seem to use the "webupd8team" method.

This really shouldn't be this hard. Is there some easier way to get this done, or is that just not something that can be done on the Raspberry Pi 3B+?

I'm open to any suggestions. Been at this for just over 4 hours, and I'm getting nowhere.

Re: How to update Java on Raspbian

Posted: Thu Jan 17, 2019 12:27 pm
by neilgl
Can't remember where I got this from on google, but this worked (for jdk-8u192) - change version number accordingly:
Download the JDK directly from Oracle’s website. Since Raspberry Pi is powered by ARM processor and Raspbian is a 32-bit OS, choose the Linux ARM 32 Hard Float ABI version.
When you have downloaded the right package, unpack it into /usr/java directory:
sudo mkdir /usr/java
cd /usr/java
sudo tar xf ~/jdk-8u111-linux-arm32-vfp-hflt.tar.gz
You can then create symbolic links in /usr/bin folder (so you’ll be able to use java command anywhere) by adding the following alternatives:
sudo update-alternatives --install /usr/bin/java java /usr/java/jdk1.8.0_111/bin/java 1000
sudo update-alternatives --install /usr/bin/javac javac /usr/java/jdk1.8.0_111/bin/javac 1000
At this point, you should be able to verify that your Java installation works by running the following command:
java -version.

Re: How to update Java on Raspbian

Posted: Thu Jan 17, 2019 6:10 pm
by M1dn1ghtN1nj4
That's perfect! I never found a method like this, although I suspected it was something that was straight forward. Just seemed that EVERYBODY had trouble with it, hence why webupd8team stepped in. Here is the command list I used to get up and running on 8u202:

Code: Select all

    sudo mkdir /usr/java
    cd /usr/java
    sudo tar xf ~/jdk-8u202-linux-arm32-vfp-hflt.tar.gz

    sudo update-alternatives --install /usr/bin/java java /usr/java/jdk1.8.0_202/bin/java 1000
    sudo update-alternatives --install /usr/bin/javac javac /usr/java/jdk1.8.0_202/bin/javac 1000

    java -version ; javac -version

Code: Select all

java version "1.8.0_202"
Java(TM) SE Runtime Environment (build 1.8.0_202-b08)
Java HotSpot(TM) Client VM (build 25.202-b08, mixed mode)
javac 1.8.0_202

Re: [SOLVED] How to update Java on Raspbian

Posted: Thu Jan 17, 2019 8:13 pm
by neilgl
I am happy it got you running - now I need to get 202!

Re: [SOLVED] How to update Java on Raspbian

Posted: Fri Jul 05, 2019 6:27 pm
by RaspianKing
Hey, I installed Raspbian using NOOBS Lite, does it already have java 8? :?
If not, how can I install it? I need it badly for a project. :geek:

Re: [SOLVED] How to update Java on Raspbian

Posted: Fri Jul 05, 2019 6:35 pm
by neilgl
Which version of raspbian did you get? Oracle Java 7 and 8 have been dropped in Buster in favour of openJDK 11 (nice one).

Re: [SOLVED] How to update Java on Raspbian

Posted: Fri Jul 05, 2019 6:44 pm
by RaspianKing
I'm not sure, just the Raspbian recommended by NOOBS. :shock:
But how can I install and older version? 8-)

Re: [SOLVED] How to update Java on Raspbian

Posted: Sat Jul 06, 2019 8:01 am
by neilgl
Ok latest NOOBS will be Raspbian “Buster”.
Does the download java from Oracle as per instructions above work for you?

Re: [SOLVED] How to update Java on Raspbian

Posted: Sat Jul 06, 2019 8:35 am
by fruitoftheloom
neilgl wrote:
Sat Jul 06, 2019 8:01 am
Ok latest NOOBS will be Raspbian “Buster”.
Does the download java from Oracle as per instructions above work for you?


https://www.raspberrypi.org/forums/view ... &#p1488909

Re: [SOLVED] How to update Java on Raspbian

Posted: Fri Jan 03, 2020 4:38 am
by tdragovich
Not sure why, but after following above instructions the link created still pointed to openjdk11. I used the command:

Code: Select all

sudo update-alternatives --remove-all java
sudo update-alternatives --remove-all javac
I then repeated the link creation and all works as it should. I hope someone far more familiar with what protections were in place could provide clarification. Maybe even a better way to fix this.

This was done on a Raspberry Pi 4 w/1Gb