M1dn1ghtN1nj4
Posts: 12
Joined: Sat Dec 16, 2017 4:22 am
Contact: YouTube

[SOLVED] How to update Java on Raspbian

Thu Jan 17, 2019 7:32 am

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.
Last edited by M1dn1ghtN1nj4 on Thu Jan 17, 2019 6:10 pm, edited 1 time in total.

User avatar
neilgl
Posts: 1370
Joined: Sun Jan 26, 2014 8:36 pm
Location: Near Aston Martin factory

Re: How to update Java on Raspbian

Thu Jan 17, 2019 12:27 pm

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.

M1dn1ghtN1nj4
Posts: 12
Joined: Sat Dec 16, 2017 4:22 am
Contact: YouTube

Re: How to update Java on Raspbian

Thu Jan 17, 2019 6:10 pm

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

User avatar
neilgl
Posts: 1370
Joined: Sun Jan 26, 2014 8:36 pm
Location: Near Aston Martin factory

Re: [SOLVED] How to update Java on Raspbian

Thu Jan 17, 2019 8:13 pm

I am happy it got you running - now I need to get 202!

User avatar
RaspianKing
Posts: 6
Joined: Mon Mar 04, 2019 9:31 pm

Re: [SOLVED] How to update Java on Raspbian

Fri Jul 05, 2019 6:27 pm

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:
I am the king of the unknown operating system called "Raspian" (not Raspbian) :lol: LOL. I am a total :geek: geek.

User avatar
neilgl
Posts: 1370
Joined: Sun Jan 26, 2014 8:36 pm
Location: Near Aston Martin factory

Re: [SOLVED] How to update Java on Raspbian

Fri Jul 05, 2019 6:35 pm

Which version of raspbian did you get? Oracle Java 7 and 8 have been dropped in Buster in favour of openJDK 11 (nice one).

User avatar
RaspianKing
Posts: 6
Joined: Mon Mar 04, 2019 9:31 pm

Re: [SOLVED] How to update Java on Raspbian

Fri Jul 05, 2019 6:44 pm

I'm not sure, just the Raspbian recommended by NOOBS. :shock:
But how can I install and older version? 8-)
I am the king of the unknown operating system called "Raspian" (not Raspbian) :lol: LOL. I am a total :geek: geek.

User avatar
neilgl
Posts: 1370
Joined: Sun Jan 26, 2014 8:36 pm
Location: Near Aston Martin factory

Re: [SOLVED] How to update Java on Raspbian

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?

fruitoftheloom
Posts: 21574
Joined: Tue Mar 25, 2014 12:40 pm
Location: Delightful Dorset

Re: [SOLVED] How to update Java on Raspbian

Sat Jul 06, 2019 8:35 am

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
Retired disgracefully.....
......to a more gentile life !

tdragovich
Posts: 6
Joined: Mon Mar 17, 2014 4:55 am

Re: [SOLVED] How to update Java on Raspbian

Fri Jan 03, 2020 4:38 am

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

Return to “Beginners”