How to Use old java 8 version on Linux (ubuntu, debian, kali, etc)

When ur trying to use oldjava 8, but gave u an error such as

Package openjdk-8-jre is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
nvidia-openjdk-8-jre
E: Package 'openjdk-8-jre' has no installation candidate
or 
Wrong Java Version Installed. Detected openjdk version "11.0.11" 2. Please use Java 1.8.0


Try this tips

  • sudo apt update
  • sudo apt-get install nvidia-openjdk-8-jre
  • set java home
    export JAVA_HOME=”/usr/lib/jvm/java-8-openjdk-amd64″
  • create alternative
    sudo update-alternatives –install “/usr/bin/java” “java” “/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java” 3
  • select the alternativ
    sudo update-alternatives –config java

 

 

Leave a Comment

Your email address will not be published. Required fields are marked *