3

When I run which java command in my Ubuntu, it tells /usr/bin/java.

I initially installed java using sudo apt-get install ... command. Using this command where does it install all java components?

In my system in /usr/lib/jvm i see the following listings:

java-1.5.0-gcj-4.8-amd64  java-1.7.0-openjdk-amd64  java-7-openjdk-amd64

I want to completely remove Java, I tried Googling, but the instructions used in didn't work. Can anyone help me do this?

amc
  • 7,142
  • Possible, but he was also asking why is which java says /usr/bin/java instead of where ever the jvm is installed to. – mjz19910 Jul 19 '16 at 22:02

1 Answers1

9

/usr/bin/java is a link to the current alternative of /usr/bin/java, you can reconfigure the default java version(including javac and whatnot) by using update-java-alternatives. If you want to reconfigure alternatives for a different debian package you can use update-alternatives --config {package} instead.

You probably don't want to remove Java, but maybe you want to remove some of the older versions.

If you do want to remove Java 6 you can run

sudo apt-get remove openjdk-6*

Or to remove Java, but i don't recommend doing this.

sudo apt-get remove openjdk*
mjz19910
  • 303
  • 3
  • 8
  • 1
    update-java-alternatives should be used instead, since it ensures ALL Java executables are switched over. You don't want to forget javac or jar or other lesser-known executables. – Olathe Jul 19 '16 at 21:00
  • Java is really useful, you probably don't want to get rid of it from a desktop. Some updated have been made. – mjz19910 Jul 19 '16 at 22:05