I found the answer to my question. It was rather easy. It was the Java version on my ubuntu 14.04 and the one expected by matlab
You can check, in MATLAB, the version of Java expected in this way:
version -java
Mine was:
'Java 1.8.0_121-b13 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode'
While from the command
update-java-alternatives -l
I had
update-java-alternatives -l
java-1.7.0-openjdk-amd64 1071 /usr/lib/jvm/java-1.7.0-openjdk-amd64
Then to solve the problem I had to update my java and I did it through
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
Restart your laptop and it should work.