1

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?

4 Answers 4

3

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.

1
  • @Alropo executing first dpkg --get-selections | grep jdk command showing nothing. Jan 8, 2013 at 9:42
0

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'
2
  • Since you are using 5 just rename your java versions to what you want to remove.
    – soniccool
    Jan 8, 2013 at 9:18
  • On running first and third command showing sudo: aptitude: command not found, second command with java 5 showing - Reading package lists... Done Building dependency tree Reading state information... Done Virtual packages like 'sun-java6-jre' can't be removed Virtual packages like 'sun-java6-plugin' can't be removed Virtual packages like 'sun-java6-fonts' can't be removed 0 upgraded, 0 newly installed, 0 to remove and 311 not upgraded. Jan 8, 2013 at 9:40
0

You should try script oab java.

0

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.