Removing all traces of GNU java and openjdk and replacing with Sun JDK

2

1

I have installed latest Sun JDk. But when I do:

java -version

I still got OpenJDK version. So I completely removed OpenJDK. But now when I do:

java -version

I get even older GNU java 1.5 something libgcj. So I completely removed that too but it was asking to remove bunch of dependent apps like OpenOffice.org Writer etc. Even though I need the writer, I let it go because I do not want ever to see the face of any GNU java on my linux. So everything related to GNU java is removed. Luckily I am able to start Eclipse and it works fine and start normally (apparently using the installed Sun JDK which is what I want). But now when I run

java -version

I get bash: /usr/bin/java: No such file or directory

Now what I need to do so that when I open any terminal window and enter java -version I should get Sun JDK version? Sun JDK is installed in /usr/java/jdk1.6.021. I also have symlinks: /usr/java/latest and /usr/java/defaults pointing to sun jdk.

As suggested in the answer, I tried the alternatives command but it did nothing. I type the --display, nothing is shown, and --config does nothing.

user61766

Posted 2011-03-20T09:25:59.553

Reputation: 227

Why are you trying to get rid of GNU Java? – Sophie Alpert – 2011-03-20T18:14:26.510

@Ben: I'm trying to do the same thing. Primarily cause PhpStorm claims to be having issues with it. I don't care whether it does or not, at this point -- what's the deal with having to rip out half the system to get rid of it? What is this, Windows? – cHao – 2012-04-16T17:41:51.797

Answers

2

on Debian 5.0.8 (lenny), i just used:

sudo update-java-alternatives -s java-6-sun

Dan D.

Posted 2011-03-20T09:25:59.553

Reputation: 5 138

1

You dont have to remove anything. On most Linux distros you can switch the java runtime environment. On fedora it is with alternatives.

To show which one is used:

alternatives --display java

To configure which one is used:

alternatives --config java

matthias krull

Posted 2011-03-20T09:25:59.553

Reputation: 2 394