Write an article based on this "Edit the system PATH file /etc/profile and add the following system variables to your system path. Scroll down using your arrow keys to the end of the file and add the following lines below to the end of your /etc/profile file in Ubuntu Linux,at this point you are going to be changing the version numbers from the old Oracle Java to the new version of Java, you will change the versions numbers in the following system PATH file /etc/profile:"
Use gedit, nano or any other text editor, as root, and open up /etc/profile   Type/Copy/Paste: sudo gedit /etc/profileor   Type/Copy/Paste: sudo nano /etc/profile Modify the /etc/profile file:JAVA_HOME=/usr/local/java/jdk1.7.0_25PATH=$PATH:$HOME/bin:$JAVA_HOME/binJRE_HOME=/usr/local/java/jre1.7.0_25PATH=$PATH:$HOME/bin:$JRE_HOME/binexport JAVA_HOMEexport JRE_HOMEexport PATHChange to this:JAVA_HOME=/usr/local/java/jdk1.7.0_40PATH=$PATH:$HOME/bin:$JAVA_HOME/binJRE_HOME=/usr/local/java/jre1.7.0_40PATH=$PATH:$HOME/bin:$JRE_HOME/binexport JAVA_HOMEexport JRE_HOMEexport PATHSave the file and exit