Add the following line at the end of the
.profile) file that is in your home directory :
This is however a very fragile approach, since it will not work as expected as soon as you update your java installation. If you want to do it more properly, I suggest a couple of ways:
look in the
/etc/alternatives folder, see if there's a link named
javapointing to the current java home (could be pointing to another link). If it's there, change the export line with
or (depending on your system), you could have a link in
/usr/lib/jvm, something like
/usr/lib/jvm/java pointing to the most recent version of the jvm you have installed. If it's there, you can use this one, so the export line is
Apart from that, if you want it to be system-wide (instead of limiting the path extension to your user), you should add the line to
/etc/bash-bashrc if it's there).
As a final note, this will only work in newly-created shells, not the ones you already have, unless you issue the command
(or the file you've modified, if it's not
.bashrc) in those shells.