Question

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?

Was it helpful?

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.

OTHER TIPS

You can search all the jre package in your system by running this command

sudo aptitude search jre

Remove it using this command

sudo apt-get remove sun-java6-jre sun-java6-plugin sun-java6-fonts

You can also try this command to remove all the java files in your system

sudo aptitude remove '~njava'

You should try script oab java.

Yes the better solution is to make more JDK versions by using "update-alternatives" command.

After that you can also set PATH using the command.

export JAVA_HOME=/usr/lib/jvm/jdk1.7.0_11 or /usr/lib/jvm/jdk1.6.0_38 export PATH=$JAVA_HOME/bin:$PATH

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top