If you are using Debian or a derivative distribution of GNU / Linux, you can use update alternatives to install what is currently running when you type java.
Try to enter
update-alternatives
This will show you what alternatives you have. This command is not destructive, that is, it does not change anything.
man update-alternatives
Gives you a tool guide. The command you most likely want is:
update-alternatives
This will give you a simple, interactive way to configure a java program. You can also use --set if you want to script it.
Of course, you should not trust me without starting up a person in the first place, because people sometimes go to the Internet and lie.;)
EDIT: I forgot, this link contains alternatives to updates in good (if Vi is specific).
source share