Finally, I figured it out. The root cause is that I was maintaining two versions of Java on my machine i.e. 1.7 and 1.8 although PATH and JAVA_HOME variables were pointing to 1.8. By trying different options with PATH and JAVA_HOME variables, I ran into further problems - Now, I was no more able to even run JMeter UI by double clicking jmeter.bat file as I started facing same error (Initially, I was able to run .bat file by double-click). I uninstalled and re-installed Java 1.8 but issue stood still.
On further investigation, I realized that maintaining two versions could be the root cause and on doing further research I came to know that I have to remove all java.exe
, javaw.exe
, and javaws.exe
from Windows\System32
and Windows\SysWOW64
folders. By following this solution, my issue is resolved completely and testplan is being executed as scheduled task.
Ref: Registry key Error: Java version has value '1.8', but '1.7' is required