HowTo: Install Zulu Embedded Java on Raspberry Pi 3

Tags: #<Tag:0x00007f6173390630> #<Tag:0x00007f6173390568> #<Tag:0x00007f61733904a0>

[Topic updated on 10/Nov/2018 to notify users to use a manual installation method (no repos)]

Please see the following link for installation information of Azul Zulu Embedded:


Don’t use the info below anymore !

[Topic updated on 02/May/2017 to include Zulu Linux APT Repositories]

Introduction

To run openHAB 2 (OH2) on a Raspberry Pi 3 (rPi3) with the standard Raspbian image, you need a working Java Runtime Environment installed on your system.

The recommended Java platform for OH2 for ARM is: Zulu Embedded (see: http://docs.openhab.org/installation/index.html#prerequisites)

Installation steps

A. Login into your rPi3, switch to root, import Azul’s public key and attach the Azul APT repository.
Commands:

sudo su
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 0x219BD9C9
echo 'deb http://repos.azulsystems.com/debian stable main' > /etc/apt/sources.list.d/zulu.list

B. Update the information about available packages and install the Zulu Embedded (ARM32bit JDK Hard Float) package.

Commands:

apt-get update -qq
apt-get install zulu-embedded-8

C. Verify the installation:
Commands:

java -version

(optional step): Use the following command to make sure that the new Zulu JDK is being used as default:

update-alternatives --config java

Main Sources of info:

  1. http://repos.azulsystems.com/
  2. http://zulu.org/zulu-community/zuludocs/
17 Likes

Great initiative @Dim! Is this a reaction to my openHABian PR? :slight_smile:

Oops :slight_smile: No… .I didn’t see it…
I will do some github stuff today. I have now some free time that the weekend is here :slight_smile:

By the way: I don’t know if we should recommend to remove any existing Java deployment (after installing Zulu) on the rPi3
Like: apt packages of: oracle-java7-jdk, oracle-java8-jdk, openjdk-8-jdk, openjdk-7-jdk, sun-java7-jdk etc etc.
What do you think?

1 Like

Thanks for the guide. But isn’t it easier to add the apt repository and work from there?

I would uninstall not used packages. But it’s my opinion ad I just get there pi running and don’t look after it until something’s wrong or when I need some extra features. Hence I want to avoid confusion having unused packages on my system.

1 Like

I didn’t find any apt repo that includes the Zulu Embedded (for ARM) package… Is there one out there?

I also prefer uninstalling old stuff from my system but it’s not mandatory (and maybe not very linux beginner friendly) since they shouldn’t interfere with the new Java installation (after someone uses with update-alternatives --config java the new Java binary)

I thought I would give this a test as I was just installing Raspian lite on my spare Raspberry pi 3. I carried out the above instructions followed by a package repository installation of Openhab using the latest snapshot.

Please to report everything went well. I then copied my live files across and all is ok except charts. None of these work and I get errors on my Habpanel charts (default or RRD4j) and the default chart that is still in the sitemap from the demo files.

2017-02-11 14:44:21.370 [WARN ] [eclipse.jetty.servlet.ServletHandler] - Error for /rrdchart.png
java.lang.NoClassDefFoundError: Could not initialize class org.rrd4j.graph.RrdGraphConstants
	at org.rrd4j.graph.RrdGraphDef.<init>(Unknown Source)[187:org.openhab.persistence.rrd4j:1.10.0.201702080211]
	at org.openhab.persistence.rrd4j.internal.charts.RRD4jChartServlet.createChart(RRD4jChartServlet.java:257)[187:org.openhab.persistence.rrd4j:1.10.0.201702080211]
	at org.openhab.persistence.rrd4j.internal.charts.RRD4jChartServlet.service(RRD4jChartServlet.java:157)[187:org.openhab.persistence.rrd4j:1.10.0.201702080211]
	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812)[81:org.eclipse.jetty.servlet:9.2.19.v20160908]
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:587)[81:org.eclipse.jetty.servlet:9.2.19.v20160908]
	at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:71)[172:org.ops4j.pax.web.pax-web-jetty:4.3.0]
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)[80:org.eclipse.jetty.server:9.2.19.v20160908]
	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577)[79:org.eclipse.jetty.security:9.2.19.v20160908]
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)[80:org.eclipse.jetty.server:9.2.19.v20160908]
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)[80:org.eclipse.jetty.server:9.2.19.v20160908]
	at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:287)[172:org.ops4j.pax.web.pax-web-jetty:4.3.0]
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)[81:org.eclipse.jetty.servlet:9.2.19.v20160908]
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)[80:org.eclipse.jetty.server:9.2.19.v20160908]
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)[80:org.eclipse.jetty.server:9.2.19.v20160908]
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)[80:org.eclipse.jetty.server:9.2.19.v20160908]
	at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:80)[172:org.ops4j.pax.web.pax-web-jetty:4.3.0]
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)[80:org.eclipse.jetty.server:9.2.19.v20160908]
	at org.eclipse.jetty.server.Server.handle(Server.java:499)[80:org.eclipse.jetty.server:9.2.19.v20160908]
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311)[80:org.eclipse.jetty.server:9.2.19.v20160908]
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)[80:org.eclipse.jetty.server:9.2.19.v20160908]
	at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544)[72:org.eclipse.jetty.io:9.2.19.v20160908]
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)[83:org.eclipse.jetty.util:9.2.19.v20160908]
	at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)[83:org.eclipse.jetty.util:9.2.19.v20160908]
	at java.lang.Thread.run(Thread.java:745)[:1.8.0_112]

I then tried to uninstall rrd4j and re-install it and got the following:

2017-02-11 15:23:37.494 [INFO ] [core.karaf.internal.FeatureInstaller] - Uninstalled 'openhab-persistence-rrd4j'
2017-02-11 15:24:07.630 [INFO ] [.eclipse.smarthome.model.script.Demo] - Status: 0  Thermostat: 19.5  Lounge: 19.30  Hall: 19.70
2017-02-11 15:24:18.836 [INFO ] [.eclipse.smarthome.model.script.Demo] - Status: 0  H/W Thermostat: 0  Hot Water: 48.31
2017-02-11 15:25:00.046 [INFO ] [.eclipse.smarthome.model.script.Demo] - ESP 4 Error
2017-02-11 15:25:49.166 [INFO ] [basic.internal.servlet.WebAppServlet] - Stopped Basic UI
2017-02-11 15:25:50.703 [ERROR] [org.eclipse.smarthome.io.rest.sse   ] - FrameworkEvent ERROR - org.eclipse.smarthome.io.rest.sse
org.osgi.framework.BundleException: Exception in org.eclipse.smarthome.io.rest.sse.internal.SseActivator.start() of bundle org.eclipse.smarthome.io.rest.sse.
	at org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:792)[org.eclipse.osgi-3.10.101.v20150820-1432.jar:]
	at org.eclipse.osgi.internal.framework.BundleContextImpl.start(BundleContextImpl.java:721)[org.eclipse.osgi-3.10.101.v20150820-1432.jar:]
	at org.eclipse.osgi.internal.framework.EquinoxBundle.startWorker0(EquinoxBundle.java:941)[org.eclipse.osgi-3.10.101.v20150820-1432.jar:]
	at org.eclipse.osgi.internal.framework.EquinoxBundle$EquinoxModule.startWorker(EquinoxBundle.java:318)[org.eclipse.osgi-3.10.101.v20150820-1432.jar:]
	at org.eclipse.osgi.container.Module.doStart(Module.java:571)[org.eclipse.osgi-3.10.101.v20150820-1432.jar:]
	at org.eclipse.osgi.container.Module.start(Module.java:439)[org.eclipse.osgi-3.10.101.v20150820-1432.jar:]
	at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:454)[org.eclipse.osgi-3.10.101.v20150820-1432.jar:]
	at org.eclipse.osgi.container.ModuleContainer.applyDelta(ModuleContainer.java:717)[org.eclipse.osgi-3.10.101.v20150820-1432.jar:]
	at org.eclipse.osgi.container.ModuleContainer.resolveAndApply(ModuleContainer.java:491)[org.eclipse.osgi-3.10.101.v20150820-1432.jar:]
	at org.eclipse.osgi.container.ModuleContainer.resolve(ModuleContainer.java:437)[org.eclipse.osgi-3.10.101.v20150820-1432.jar:]
	at org.eclipse.osgi.container.ModuleContainer.refresh(ModuleContainer.java:955)[org.eclipse.osgi-3.10.101.v20150820-1432.jar:]
	at org.eclipse.osgi.container.ModuleContainer$ContainerWiring.dispatchEvent(ModuleContainer.java:1336)[org.eclipse.osgi-3.10.101.v20150820-1432.jar:]
	at org.eclipse.osgi.container.ModuleContainer$ContainerWiring.dispatchEvent(ModuleContainer.java:1)[org.eclipse.osgi-3.10.101.v20150820-1432.jar:]
	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)[org.eclipse.osgi-3.10.101.v20150820-1432.jar:]
	at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)[org.eclipse.osgi-3.10.101.v20150820-1432.jar:]
Caused by: java.lang.LinkageError: ClassCastException: attempting to castbundleresource://22.fwk2402365/javax/ws/rs/ext/RuntimeDelegate.class to bundleresource://22.fwk2402365/javax/ws/rs/ext/RuntimeDelegate.class
	at javax.ws.rs.ext.RuntimeDelegate.findDelegate(RuntimeDelegate.java:146)
	at javax.ws.rs.ext.RuntimeDelegate.getInstance(RuntimeDelegate.java:120)
	at javax.ws.rs.core.MediaType.valueOf(MediaType.java:179)
	at org.glassfish.jersey.media.sse.SseFeature.<clinit>(SseFeature.java:62)
	at org.eclipse.smarthome.io.rest.sse.internal.SseActivator.start(SseActivator.java:44)
	at org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:771)[org.eclipse.osgi-3.10.101.v20150820-1432.jar:]
	at org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:1)[org.eclipse.osgi-3.10.101.v20150820-1432.jar:]
	at java.security.AccessController.doPrivileged(Native Method)[:1.8.0_112]
	at org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:764)[org.eclipse.osgi-3.10.101.v20150820-1432.jar:]
	... 14 more
2017-02-11 15:25:51.124 [INFO ] [basic.internal.servlet.WebAppServlet] - Started Basic UI at /basicui/app
2017-02-11 15:25:51.473 [ERROR] [core.karaf.internal.FeatureInstaller] - Failed installing 'openhab-persistence-rrd4j': Error restarting bundles

Yup… there is something wrong with the charts…

Check: https://github.com/openhab/openhabian/pull/92#issuecomment-279101406

Thanks for the prompt response. Being a ‘user’ the conversation on the github link doesn’t mean much to me. I hadn’t heard of Zulu Java until this thread but now I can see that whilst it is the preferred Java platform for Openhab, it doesn’t work on perhaps the most widely used hardware, the Raspberry Pi?

Thankfully this isn’t my live system. What do you suggest I do? Start again and use Oracle? I was actually doing this because I wanted to try the new ‘timeline’ widget in HABPanel.

The link was for the packages installation command (sorry… I replied from my Discourse (forum) client on the smart phone and couldn’t type up a proper reply)

sudo apt install libfontconfig1 fontconfig ttf-dejavu

It might be the fix to the charts issue (not sure). There are many testers (like me) who are trying to iron out these issues.

Definitely yes… that would be the safest option in this moment… :slight_smile:

1 Like

Thanks, I do appreciate the work you do on this forum. I’ll give it a try.

1 Like

It worked! After a reboot the charts are back. Many thanks.

1 Like

That’s excellent feedback! Thanx
I was planning to test myself @ThomDietrich 's solution but you beat me to the punch :slight_smile:

Hi Dim,
mere curiosity: why you would say that Zulu Embedded is the raccomended Java platform for OH2 on ARM?

Did you make any comparison with the usual Oracle SE?

To be clear: this is no provocation, I’m just really interested in your criteria.

Thanks in advance,

Roberto

This was already discussed in length and you can find the details here: http://docs.openhab.org/installation/index.html#prerequisites :wink:

Oops… sorry, I’ll take a look! :sweat_smile:

I didn’t see a clear benefit of Zulu over Oracle JDK in that link - were there some sort of performance stats in favour of Zulu over Oracle JDK on ARM?

To clarify, you can still use Oracle Java. It’s just the official recommendation by the openHAB maintainers. Let me quote what was previously said by @Kai:

The main reason is that there are “no license fees or field of use restrictions”.
Oracle JDK is (at lease on embedded systems) always subject to certain restrictions. You are actually only allowed to use it for development, but not for production. And a “pure” openHAB user probably does not really qualify as doing active development work. See https://blog.takipi.com/running-java-on-docker-youre-breaking-the-law

Besides that, we have done performance comparisons and there are no measurable differences (to the better or the worse). In the end, there was no downside to use and recommend a open source / free Java runtime, which is by the way also easier to install (looking at the soon to be available repository for arm).

1 Like

Dear Thom,

I must say that you are right: Oracle asks for money for each and every embedded device legally (or not) sold. The free Java runtime available is I must say (after all the missing sleep nights) a very good alternative for DIY solutions.
Not to be confusing to the openhab users: it does not in any way influence your openhab experience!

Best regards,

George

i think you can add zulu through repos, check my post here:

That is correct. openHABian does the same thing (see here)
@Dim would you please update your article?

1 Like