I tried to install latest stable Jenkins version which supports Java 11. So after installing Java 11(JDK) I got the error from Jenkins that incorrect java version was found.
So uninstalled the Java 11 and tried to install Java 8. While installing java 8, the Jenkins message "incorrect java version found" was repeatedly coming. So I completely removed both Java 11(JDK) and Java 8(JDK) and made sure no folders are there in /usr/bin and /usr/lib/jvm for both java 11 and java 8. When I installed java 8 the system says JDK 8 installed but im not able to find any java version in my system. Why?
I tried both sudo apt install openjdk-8-jre-headless
and sudo apt install openjdk-8-jdk
but java is not there in /usr/bin and /usr/lib/jvm has java8jdk but it doesn't have java in bin folder. Please see the command and the console output below.
sudo apt install openjdk-8-jdk
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
daemon net-tools
Use 'sudo apt autoremove' to remove them.
Suggested packages: openjdk-8-demo openjdk-8-source visualvm
The following NEW packages will be installed
openjdk-8-jdk
0 upgraded, 1 newly installed, 0 to remove and 14 not upgraded.
Need to get 0 B/1,435 kB of archives. After this operation, 1,538 kB of additional disk space will be used.
Selecting previously unselected package openjdk-8-jdk:amd64. (Reading database ... 168837 files and directories currently installed.)
Preparing to unpack .../openjdk-8-jdk_8u191-b12-2ubuntu0.18.04.1_amd64.deb ...
Unpacking openjdk-8-jdk:amd64 (8u191-b12-2ubuntu0.18.04.1) ...
Setting up openjdk-8-jdk:amd64 (8u191-b12-2ubuntu0.18.04.1) ..
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/appletviewer to provide /usr/bin/appletviewer (appletviewer) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/jconsole to provide /usr/bin/jconsole (jconsole) in auto mode
When I tried openjdk-jre-headless I got the below
sudo apt install openjdk-8-jre-headless
Reading package lists... Done
Building dependency tree Reading state information... Done
openjdk-8-jre-headless is already the newest version (8u191-b12-2ubuntu0.18.04.1).
The following packages were automatically installed and are no longer required:
daemon libice-dev libpthread-stubs0-dev libsm-dev libx11-dev libx11-doc libxau-dev libxcb1-dev libxdmcp-dev libxt-dev net-tools openjdk-8-jdk-headless x11proto-core-dev x11proto-dev xorg-sgml-doctools xtrans-dev
Use 'sudo apt autoremove' to remove them. 0 upgraded, 0 newly installed, 0 to remove and 14 not upgraded
Still no use. I am not able to find java. which java
returns nothing. java -version
returns following.... Command 'java' not found, but can be installed with: sudo apt install default-jre sudo apt install openjdk-11-jre-headless sudo apt install openjdk-8-jre-headless
Could someone please help me on this issue? How to install java correctly? After removing/uninstalling Jenkins also I tried to install java but no use. Is jenkins that I installed previously blocking any java installaion?