JDK Required: ‘tools.jar’ seems to be not in Studio classpath

I was installing android studio on ubuntu and come across this error.

After lots of searching I found this simple soutuion that worked for me.

This is caused by having JAVA JRE installed as opposed to JAVA JDK. Installing JDK resolve the problem.