M BUZZ CRAZE NEWS
// general

Change java version from 1.8.0_161 to 1.8.0_151 Ubuntu 16.04

By Emma Martinez

I am using ubuntu 16.04 LTS.

...$ java -version
java version "1.8.0_161"
Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)
...$ echo $JAVA_HOME
/usr/lib/jvm/java-8-oracle

I have tried to use multiple versions of java using the answer mentioned is this post.

...$ which java
/usr/bin/java

Downloaded jdk 1.8.0_151 from this link:

Extracted it in home/b/ then tried the following command as mentioned in the post.

...$ export PATH=/home/b/jdk1.8.0_151/bin:$PATH
... $ which java
/usr/bin/java

I am still getting the same java.

I have also tried:

...$ sudo update-alternatives --config java
here is 1 choice for the alternative java (providing /usr/bin/java).
Selection Path Priority Status
------------------------------------------------------------ 0 /usr/lib/jvm/java-8-oracle/jre/bin/java 1081 auto mode
* 1 /usr/lib/jvm/java-8-oracle/jre/bin/java 1081 manual mode

This is my $PATH:

...$ echo $PATH
/home/b/jdk1.8.0_151/bin:/home/junaid/anaconda2/bin:/usr/local/sbin:/usr/local/bin:
/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:
/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin

Should I remove Java and download again? If yes, then how?

1 Answer

I had an issue as follows:

>Checking build tools versions...
>************************************************************
>You asked for an OpenJDK based build but your version is
>java version "1.8.0_161" Java(TM) SE Runtime Environment (build 1.8.0_161-b12) Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode).
>************************************************************
>build/core/main.mk:175: error: stop.
>09:36:38 ckati failed with: exit status 1
>build/core/main.mk:21: recipe for target 'run_soong_ui' failed
>make: *** [run_soong_ui] Error 1
>#### make failed to build some targets (01:40 (mm:ss)) ####

The issue is solved for me by removing Oracle path from $EXPORT.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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