Xubuntu 16.04 + Java9:

Linux howto's, compile information, information on whatever we learned on working with linux, MACOs and - of course - Products of the big evil....
Post Reply
User avatar
^rooker
Site Admin
Posts: 1481
Joined: Fri Aug 29, 2003 8:39 pm

Xubuntu 16.04 + Java9:

Post by ^rooker »

[PROBLEM]
Accidentially installed Java 9 on Xubuntu 16.04 (instead of Java 8).
I've removed Java 9, installed Java 8 and wanted to update the symlink using "update-alternatives" (as usual):

Code: Select all

$ sudo apt-get remove openjdk-9-jre-headless
$ sudo update-alternatives --config java
This didn't work as expected and returned the following message:
update-alternatives: warning: /etc/alternatives/java is dangling; it will be updated with best choice
There is only one alternative in link group java (providing /usr/bin/java): /usr/lib/jvm/java-9-openjdk-amd64/bin/java
Nothing to configure.
2 things are strange/wrong here:

1) "/usr/lib/jvm" does contain more than just "java-9-openjdk-amd64":

Code: Select all

lrwxrwxrwx   1 root root   20 Okt 27 21:06 java-1.8.0-openjdk-amd64 -> java-8-openjdk-amd64
-rw-r--r--   1 root root 2600 Okt 27 21:06 .java-1.8.0-openjdk-amd64.jinfo
drwxr-xr-x   5 root root 4096 Jän  1 15:23 java-8-openjdk-amd64
drwxr-xr-x   3 root root 4096 Jän  1 15:32 java-9-openjdk-amd64
So why doesn't update-alternatives just offer OpenJDK 8?

2) I've removed Java 9 - so why is the folder still here?
:?


[SOLUTION]
"A solution", but not really a clean one is to simply update the symlink "/usr/bin/java" to point to the Java 8 binary:

Code: Select all

sudo ln -sf /usr/lib/jvm/java-8-openjdk-amd64/bin/java /usr/bin/java 
Yet, I'm still feeling a bit uncomfortable having Java9-leftovers on my system - and an obviously confused "update-alternatives"...
Jumping out of an airplane is not a basic instinct. Neither is breathing underwater. But put the two together and you're traveling through space!
gilthanaz
Site Admin
Posts: 444
Joined: Fri Aug 29, 2003 9:29 pm
Contact:

Re: Xubuntu 16.04 + Java9:

Post by gilthanaz »

Have you tried:

Code: Select all

$ sudo apt-get purge <packagename>
$ sudo apt-get autoremove
$ sudo apt-get autoclean
Post Reply