Well, many things to have in mind here.
First is... it doesnt matter what java_home you use, it will still look your path first! Your path is using java7! You should remove the java hardcoded from path and instead use the JAVA_HOME/bin in the path. Maybe you switch user when you modified the environment variables? Also dont forget to export JAVA_HOME before export PATH!
Second... You might have a system global java, but want to run eclipse with some other jre. Check your -vm setting in eclipse.ini (normally in /etc/eclipse.ini)
Add this top of your eclipse.ini
-vm
/opt/java/jdk1.8.0_20/bin/java
From askubuntu (regarding why PATH update doesnt work)
There are a few places where you can define $PATH
:
/etc/environment
is a plain text file (not a script) that affects all
users ~/.pam_environment
- the same thing but user-specific bash
also
executes some scripts which can be used for modifying $PATH
:
~/.profile
is executed for a login shell sessions (don't ask me what
it means :)
~/.bashrc
is executed for non login interactive shell
sessions
/etc/profile
and /etc/bash.bashrc
are system wide
alternatives for ~/.profile
and ~/.bashrc
I read somewhere that
/etc/environment
is a recommended place for defining your $PATH
. So I
usually use it. But your path is probably modified in one of the other
places.
BTW, when you execute a command with sudo
, I think it normally uses
root
user's $PATH (and not the $PATH of your unprivileged user
account). So, ~/.pam_environment, ~/.profile
and ~/.bashrc
in /root
directory may also play a role.