Upgrade to Latest Java

I’m trying to get my.openhab to work in order to access my data remotely and read that there were issues with old builds of java that may solve my problem.

It looks like I’m currently on build 65, but I’ve read that the build is over 101. How can I pull whatever the latest version is automatically?

pi@raspberrypi:~ $ java -version
java version "1.8.0_65"
Java(TM) SE Runtime Environment (build 1.8.0_65-b17)
Java HotSpot(TM) Client VM (build 25.65-b01, mixed mode)

Hello,
presuming you are on a standard Linux system like Ubuntu or Raspbian, here are the steps you need to take. There might be slight changes needed if you are on another platform

2 Likes

Yes, I’m on Raspbian and Openhab 1.

Then these should be the commands you need to execute one after the other. (One exception is the cat…EOT part which is a four lines command)

If you run into any problems let me know.

Thanks for your help! I’m now on 101!

pi@raspberrypi:~ $ java -version
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) Client VM (build 25.101-b13, mixed mode)

I fail!

I tried to follow your instructions but I fail … I gues something went wrong in line 4 with EOT!!
I’ve to admit, I’m not familiar whit Linux! So I don’t understand what there is going on!

But what I understand is to start and stop the OH Service. Due to the fact I’m running 1.8 I did it “my way”…

pi@Lisa:~ $ sudo /etc/init.d/openhab stop
[ ok ] Stopping openhab (via systemctl): openhab.service.
pi@Lisa:~ $ sudo su
root@Lisa:/home/pi# apt purge oracle-java8-jdk
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libxi6 libxrender1 libxtst6 x11-common
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
  oracle-java8-jdk*
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 173 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 34540 files and directories currently installed.)
Removing oracle-java8-jdk (8u65) ...
root@Lisa:/home/pi# cat <<EOT >> /etc/apt/sources.list.d/webupd8team-java.list
> cat <<EOT >> /etc/apt/sources.list.d/webupd8team-java.list
> deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main
> deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main
> EOT
root@Lisa:/home/pi# apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886
Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --homedir /tmp/tmp.V1Z61fAIPe --no-auto-check-trustdb --trust-model always --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886
gpg: requesting key EEA14886 from hkp server keyserver.ubuntu.com
gpg: key EEA14886: public key "Launchpad VLC" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
root@Lisa:/home/pi# apt update
E: Type 'cat' is not known on line 1 in source list /etc/apt/sources.list.d/webupd8team-java.list
E: The list of sources could not be read.
root@Lisa:/home/pi# apt -y install oracle-java8-installer
Reading package lists... Error!
E: Type 'cat' is not known on line 1 in source list /etc/apt/sources.list.d/webupd8team-java.list
E: The list of sources could not be read.
E: The package lists or status file could not be parsed or opened.
root@Lisa:/home/pi# apt -y install oracle-java8-set-default
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package oracle-java8-set-default
root@Lisa:/home/pi# /etc/init.d/openhab start
[ ok ] Starting openhab (via systemctl): openhab.service.
root@Lisa:/home/pi# java-version
bash: java-version: command not found
root@Lisa:/home/pi# java -version
bash: java: command not found

It seems now I’ without Java?!

Your problem is caused by an error in the /etc/apt/sources.list.d/webupd8team-java.list file:

Edit the file using an text editor such as nano or vi and make sure that only the following two lines are present in the file (delete any others):

deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main
deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main

Then execute:

sudo apt update
sudo apt -y install oracle-java8-set-default

Note: the lines starting with an E: prefix indicate an error. Make sure no such lines are shown before attempting to install java.

Thank you, I found an other solution / update instructions…
-> My.openhab.org is online // iOS app doesn't show sitemap -> Solution: Java update!

this one worked fine for me!

thy anyway!