1

I installed oracle jdk on ubuntu 14.04. Now I want to toggle back to openjdk:

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

But it doesn't work. It seems oracle's jdk somehow keeps adding itself to my $PATH:

...:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin:...

I've found and killed /etc/profile.d/jdk.csh, but there seems to be a failsafe. The audacity!!

How can I fix this?

jozxyqk
  • 1,093
  • 15
  • 26
  • What of the `jdk.sh` in that same location, did you kill that too? – George Udosen Mar 20 '17 at 19:56
  • @George There aren't any other related files there. I've tried searching through /etc but haven't found anything else updating PATH. – jozxyqk Mar 20 '17 at 20:50
  • 2
    Possible duplicate of [How to remove Oracle JDK](http://askubuntu.com/questions/117543/how-to-remove-oracle-jdk) – George Udosen Mar 20 '17 at 23:30
  • This would have been the best way to remove it `sudo update-alternatives --remove "java" "/usr/lib/jvm/jdk[version]/bin/java" ` – George Udosen Mar 20 '17 at 23:31
  • @George I'd prefer not to actually remove it if possible. I just want to temporarily swap to openjdk and then swap back again. It seems like `update-alternatives` was designed for this. – jozxyqk Mar 21 '17 at 02:09
  • Then `sudo update-alternatives --config java` should have shown the the three then you pick from there... – George Udosen Mar 21 '17 at 05:58
  • @George yes, but it didn't so I posted this question here. – jozxyqk Mar 21 '17 at 08:08
  • Then add it so you can make it the default... – George Udosen Mar 21 '17 at 08:48
  • I'm not sure what you mean. I've selected openjdk using the above `update-alternatives` commands. It doesn't work, because that seems to use symlinks but oracle's jdk is overriding my PATH which takes priority. I don't know how the values are being added to PATH and am hoping someone here can point me in the right direction. – jozxyqk Mar 21 '17 at 22:43

1 Answers1

0

I think you are on the right track by removing /etc/profile.d/jdk.csh and /etc/profile.d/jdk.sh. You just have to re-login or reboot so that the PATH changes have effect.