Kali Linux update-alternatives --config java

Viewed 279

I am attempting to use L3MON to build an apk. It requires me to select Java 1.80 OpenJDK as I am currently running, however when I use sudo update-alternatives --config java it does not supply me with the option to select 1.80. See below.

I have installed Java 8 OpenJDK and it reflects in my /usr/lib/jvm file structure. I just can't seem to get the option to select it to use for L3MON.

enter image description here

enter image description here

enter image description here

1 Answers

To switch between installed JDKs:

  1. List Java alternatives:

    update-java-alternatives -l
    
  2. Find the line with the Java version that you want to select.

  3. The output of update-java-alternatives -l will look something like this if Java 8 was installed by sudo apt install openjdk-8-jdk which also matches the 2nd screenshot in your question.

    java-1.11.0-openjdk-amd64      1111       /usr/lib/jvm/java-1.11.0-openjdk-amd64
    java-1.8.0-openjdk-amd64       1081       /usr/lib/jvm/java-1.8.0-openjdk-amd64

    The first part of the second line there is java-1.8.0-openjdk-amd64.

  4. Set the first part of the line you want as the Java alternative.

    sudo update-java-alternatives -s java-1.8.0-openjdk-amd64

To sum it all up the key thing to watch for here is that you have installed both of the Java versions that you want to switch between with apt so that both Java versions will be recognized.

Related