I am using jdk1.8.0_25, and when I check the version of Java with the following command:
jdk1.8.0_25
java -version
it outputs the followin
I got the same error, and while the java version correctly set to 8, my JAVA_HOME env var was still set to 7.
Executing this fixed it for me:
export JAVA_HOME=/usr/lib/jvm/java-8-oracle