I was following a scala tutorial and I was using SBT as the build tool. This SBT version required JDK 7 but I had environmental variables set for JDK8 even though I had both installed on my machine.
To make SBT use JDK7 without changing JAVA_HOME environmental variable, this is what I did.
First created a new environmental variable JAVA_HOME7(any name which is not already being used) with the path to JDK7 as the value.
Then replaced JAVA_HOME in the sbt.bat file(which is inside the sbt folder inside program files folder) with JAVA_HOME7.