First One is
Edit the system Path file /etc/profile
sudo -H gedit /etc/profile # always use -H when you sudo a gui program or anything else which might write config files to the $HOME directory.
Add following lines in end
JAVA_HOME=/usr/lib/jvm/jdk1.7.0 PATH=$PATH:$HOME/bin:$JAVA_HOME/bin export JAVA_HOME export JRE_HOME export PATH
sudo gedit /etc/environment
then add these lines
JAVA_HOME = ":usr/lib/jvm/java-7-openjdk-amd64/bin" CLASSPATH = ":usr/lib/jvm/java-7-openjdk-amd64/bin:/home/something etc whatever you want etc"