2

Platform: Ubuntu 15.04.

During building android 4.4.2_r1/ or phablet, it's stopped by the message:

"You are attempting to build with the incorrect version of java. Your version is: Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar . The correct version is: Java SE 1.6." Output:

$ make j 4 ..................................................................................................................................................

Checking build tools versions...


You are attempting to build with the incorrect version of java. Your version is: Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar .

The correct version is: Java SE 1.6.


build/core/main.mk:168: *** stop. Stop.

I already remove/ uninstall all the openjdk, but everytime check java version, the output is

$ java -version

Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar

java version "1.6.0_45"

Java(TM) SE Runtime Environment (build 1.6.0_45-b06)

Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode)

If reinstalling the oracle-java6:

sudo apt-get install --reinstall oracle-java6-installer

during the progress, I'm noticed with the message:

"update-binfmts: warning: current package is oracle-java6, but binary format already installed by openjdk-7"

If apply "sudo dpkg --list | grep -i jdk", the output:

:~$ sudo dpkg --list | grep -i jdk

ii oracle-java6-installer 6u45-0~webupd8~8 all Oracle Java(TM) Development Kit (JDK) 6

rc oracle-java7-installer 7u80+7u60arm-0~webupd8~0 all Oracle Java(TM) Development Kit (JDK) 7

I think, may the "binary format already installed by openjdk-7" remain existing be the cause.

So, the question is: how to remove the binary format, which already installed by openjdk-7?

evergreen
  • 975

3 Answers3

4

Running this command did it for me:

sudo update-binfmts --package openjdk-7 --remove jar /usr/bin/jexec
sudo dpkg-reconfigure openjdk-13-jre-headless

See http://www.askmeaboutlinux.com/?p=3137.

Eliah Kagan
  • 117,780
Oxi
  • 41
4

The trouble's fixed, steps I performed:

  1. sudo rm /var/lib/binfmts/jar
  2. Remove the package jayatana from Ubuntu software center.
  3. Remove all the Java related packages (Sun, Oracle, OpenJDK, IcedTea plugins, GIJ):

    sudo apt-get update
    apt-cache search java | awk '{print($1)}' | grep -E -e '^(ia32-)?(sun|oracle)-java' -e '^openjdk-' -e '^icedtea' -e '^(default|gcj)-j(re|dk)' -e '^gcj-(.*)-j(re|dk)' -e 'java-common' | xargs sudo apt-get -y remove
    sudo apt-get -y autoremove
    
  4. Purge config files:

    dpkg -l | grep ^rc | awk '{print($2)}' | xargs sudo apt-get -y purge
    
  5. Remove Java config and cache directory:

    sudo bash -c 'ls -d /home/*/.java' | xargs sudo rm -rf
    
  6. Remove manually installed JVMs:

    sudo rm -rf /usr/lib/jvm/*
    
  7. sudo apt-get update

  8. Reboot
  9. Re-install the oracle-java6:

    sudo apt-get install oracle-java6-installer
    

Reference: How to completely uninstall Java?

evergreen
  • 975
2

I had a similar issue with remnants of openjdk-11 conflicting with openjdk-17. The above solution pointed me in the right direction but was slightly incomplete at least in my case.

First I found the remnant openjdk-11 packages:

dpkg --list | grep openjdk-11

Then I purged those packages, e.g.:

sudo apt purge openjdk-11-jre openjdk-11-jre-headless

Next I updated binfmts to remove openjdk-11:

sudo update-binfmts --package openjdk-11 --remove jar /usr/bin/jexec

The solution above uses dpkg-reconfigure but I did reinstall instead:

sudo apt reinstall openjdk-17-jre openjdk-17-jre-headless