Please follow the simple following steps:
1. Go to:
Applications > Accessories > Terminalto open the terminal window.
2. You should take a back up of /etc/profile file. So write the commands:
sudo cp -p /etc/profile /etc/profile_backup
3. Now, to edit the /etc/profile file, write the following command in the terminal:
gksudo gedit /etc/profileThe file will be opened for editing.
4. You have to add one line at the end of the file. That line will tell the name of the variable and it's value.
Format for this command is:
export ENV_VARIABLE_NAME=VALUEwhere ENV_VARIABLE_NAME is the name of the variable and VALUE is the value.
export JAVA_HOME=/mnt/F/ubuntu/j2sdk1.4.2_16here /mnt/F/ubuntu/j2sdk1.4.2_16 - this path is the value of the variable JAVA_HOME.
5. Save your file and close it.
6. Restart your machine.
7. You can check if the value is properly set with these commands: