1

I installed java default packages in Ubuntu 18.04 and tried to install Jenkins. When this did not work I searched for reasons for this and found that Jenkins needs Java 8 and the default Java in Ubuntu 18.04 is Java 10.

So, I removed all the files of Java from /usr/lib/jre folder and tried to install Java 8. It says they are already installed without downloading packages and when I tried to verify the version it said JAVA NOT FOUND.

How could I solve this issue?

  • 3
    Possible duplicate of Can't install Oracle Java 8 in Ubuntu 16.04 – karel Jan 16 at 14:44
  • 1
    It is a very bad idea to try to remove software installed by package managers by deleting files. Maybe you're new to Linux and don't realise that software components are distributed to various location in the system, that packages depend on each other and that a database of what is installed is meticulously maintained by the package management system. If this database is corrupted by you making its info wrong by deleting stuff, sooner or later your system will be FUBAR and you will have great trouble figuring out how to fix it. I strongly suggest you learn to use package managers like APT. – Zanna Jan 21 at 20:43
0

I had the same issue.

Info in repositories is not right.

If you follow logs you'll find the version you're installing is an archive. For me it was u191 today: 2019/01/16 but on website it's u201 or u202.

you have to change your repo info like this:

cd /var/lib/dpkg/info
sudo sed -i 's|JAVA_VERSION=8u191|JAVA_VERSION=8u201|' oracle-java8-installer.*
sudo sed -i 's|PARTNER_URL=http://download.oracle.com/otn-pub/java/jdk/8u191-b12/2787e4a523244c269598db4e85c51e0c/|PARTNER_URL=https://download.oracle.com/otn-pub/java/jdk/8u201-b09/42970487e3af4f5aa5bca3f542482c60/|' oracle-java8-installer.*
sudo sed -i 's|SHA256SUM_TGZ="53c29507e2405a7ffdbba627e6d64856089b094867479edc5ede4105c1da0d65"|SHA256SUM_TGZ="cb700cc0ac3ddc728a567c350881ce7e25118eaf7ca97ca9705d4580c506e370"|' oracle-java8-installer.*
sudo sed -i 's|J_DIR=jdk1.8.0_191J_DIR=jdk1.8.0_201|' oracle-java8-installer.*

Information is on Oracle's download website.

See answers to Can't install Oracle Java 8 in Ubuntu 16.04

0

Why to install and make it complicated?

Instead of installing Jenkins using package manager sudo apt install, a better option is run Jenkins as war.

  1. Download the latest stable Jenkins WAR file to an appropriate directory on your machine.
  2. Open up a terminal/command prompt window to the download directory.
  3. Run the command java -jar jenkins.war.
  4. Browse to http://localhost:8080 and wait until the Unlock Jenkins page appears.

By default Jenkins runs on port 8080, change port using java -jar jenkins.war --httpPort=9090


To keep jenkins running on Ubuntu even after terminal is closed, use

nohup java -jar jenkins.war --httpPort=9090 &

See Installing Jenkins for more options.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.