Search code examples
linuxubuntu-11.04java-5

How to remove java5 from ubuntu 11.04?


I want to remove java5 completely from my ubuntu 11.04 system. On executing java -version, it showing -

java version "1.5.0"
gij (GNU libgcj) version 4.4.5
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

How can I remove it?


Solution

  • If you want to remove completely that java version you need to remove the packages that contain it, see a list of packages with:

    sudo dpkg --get-selections | grep jre
    

    In this way you see what jre packages you've installed. Then you can remove the packages with:

    sudo apt-get remove old_jre_package
    

    Anyway a better solution is to make more JDK versions coesist, in Ubuntu is easy to do it. You can use the update-alternatives command. So you can install another JDK and switch between the jdk versions with the alternative tools:

    sudo update-alternatives --config java
    sudo update-alternatives --config javac
    

    For more options see the man page man update-alternatives.