steve103
Posts: 16
Joined: Sun Oct 29, 2017 1:11 pm

how install openjdk?

Wed Dec 13, 2017 2:32 am

I require to install openjdk (7 / 8 or above) on to my pi.
I have (currently) installed noobs/raspbian/oracle jdk (from https://www.raspberrypi.org/...) on to the SD card.
Please can you advise (pref with steps) how I do this? Is openjdk already on the sd card? I don't think so
since dpkg.. showed it is not installed.
which implementation of openjdk is usually used with the pi?
where do I download it from?
how upload to sd card / install?

thank you.

ghans
Posts: 7893
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany

Re: how install openjdk?

Wed Dec 13, 2017 7:57 am

Code: Select all

sudo apt-get update
sudo apt-get install -y galternatives openjdk-8-jdk
Use galternatives to switch between Oracle and OpenJDK as needed.

ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org

klricks
Posts: 8735
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA

Re: how install openjdk?

Wed Dec 13, 2017 1:15 pm

openjdk-9-jdk is also available in the repository.
Unless specified otherwise my response is based on the latest and fully updated RPi OS Bullseye w/ Desktop OS.

steve103
Posts: 16
Joined: Sun Oct 29, 2017 1:11 pm

Re: how install openjdk?

Thu Dec 14, 2017 8:47 am

thank you for reply.
However when I type: sudo apt-get update,
error messages are shown and the install fails also (see below)
I am not connected to the internet - do I need to be?
Do I need to modify config file?
I do not currently have access to the ethernet/internet - can/how do
I install using SD card?

Err http://mirrordiringector.raspbian.org jessie Release...
Temporary failure resolving 'mirror.director.raspbian.org'
...
Failed to fetch http://mirrordirector.../raspbian/dists ... /InRelease
Failed to fetch http://archive.raspberrypi.org/debian/d ... elease.gpg
...
Some index files failed to download

thank you

fruitoftheloom
Posts: 27225
Joined: Tue Mar 25, 2014 12:40 pm

Re: how install openjdk?

Thu Dec 14, 2017 9:25 am

steve103 wrote:
Thu Dec 14, 2017 8:47 am
thank you for reply.
However when I type: sudo apt-get update,
error messages are shown and the install fails also (see below)
I am not connected to the internet - do I need to be?
Do I need to modify config file?
I do not currently have access to the ethernet/internet - can/how do
I install using SD card?

Err http://mirrordiringector.raspbian.org jessie Release...
Temporary failure resolving 'mirror.director.raspbian.org'
...
Failed to fetch http://mirrordirector.../raspbian/dists ... /InRelease
Failed to fetch http://archive.raspberrypi.org/debian/d ... elease.gpg
...
Some index files failed to download

thank you

Yes internet is a requirement of apt-get update....................
Take what I advise as advice not the utopian holy grail, and it is gratis !!

ksnortum
Posts: 3
Joined: Mon Apr 23, 2018 4:02 pm

Re: how install openjdk?

Fri Jan 04, 2019 6:54 pm

When I issue the apt-get install command I get a slew of errors, starting with:

Setting up ca-certificates-java (20170531+nmu1) ...
Error: missing `server' JVM at `/usr/lib/jvm/java-8-openjdk-armhf/jre/lib/arm/server/libjvm.so'.
Please install or use the JRE or JDK that contains these missing components.
dpkg: error processing package ca-certificates-java (--configure):
subprocess installed post-installation script returned error exit status 4
Processing triggers for mime-support (3.60) ...
Processing triggers for desktop-file-utils (0.23-1) ...
Processing triggers for sgml-base (1.29) ...
Setting up python-gobject-2 (2.28.6-13) ...
Setting up libglade2-0:armhf (1:2.6.4-2) ...
Processing triggers for libc-bin (2.24-11+deb9u3) ...
Setting up python-cairo (1.8.8-2.2) ...
Processing triggers for man-db (2.7.6.1-2) ...
Processing triggers for gnome-menus (3.13.3-9) ...
dpkg: dependency problems prevent configuration of openjdk-8-jre-headless:armhf:
openjdk-8-jre-headless:armhf depends on ca-certificates-java; however:
Package ca-certificates-java is not configured yet.

Does anyone know how to fix these errors?

User avatar
neilgl
Posts: 6093
Joined: Sun Jan 26, 2014 8:36 pm
Location: Near The National Museum of Computing

Re: how install openjdk?

Fri Jan 04, 2019 7:11 pm

Maybe you are using an old version of noobs (raspbian jessie) so best bet is to start with a fresh install of raspbian (stretch) from the current Noobs download or current Rasbian Stretch with Desktop.

ksnortum
Posts: 3
Joined: Mon Apr 23, 2018 4:02 pm

Re: how install openjdk?

Sun Jan 06, 2019 1:04 am

No, it's stretch, and I just re-installed it. It seems to be a certificates problem, as I also get similar errors when Maven tries to download anything.

I'm reading up on ca-certificates now. I should probably start a new thread if I have questions about that, huh?

knute
Posts: 886
Joined: Thu Oct 23, 2014 12:14 am
Location: Texas

Re: how install openjdk?

Sun Jan 06, 2019 8:20 pm

I got around that by uninstalling the installed Java first. Then install openjdk. I'm not sure but I think it is a problem with the installer looking in the wrong place for certificates (but I could definitely be wrong).

Return to “Beginners”