First go to environment variables. You must be aware that under System variables there is a variable named Path, chose to edit that variable then there would be an entry like Oracle\Java\javapath\java.exe ..remove it and add the required Jre path till bin folder and don't forget to create JAVA_HOME user variable.ItThis will resolve evry problem relatedsolve all problems relating to Java in you machine.and environment variables:
Make your way to Windows' Environment Variables dialog.
Under System variables, select the variable named Path. Click Edit...
Remove the entry that looks like:
C:\ProgramData\Oracle\Java\javapathAdd the path of your JDK/JRE's
binfolder.Don't forget to set JAVA_HOME.