After the update of java 1.8.0_45 my eclipse stopped working because it is unable to locate old version of java and got error "unable to locate JRE 1.8.0_40", following are steps to solve the problem.
1. Go to file which you want to run
2.Right click on file -> go to "Run as"- > Go to "Run Configurations"
3. on the right large box of Run configuration go to JRE tab and select alternate JRE and click on installed JRE, on the right side select add button -> select standard VM and in the JRE home select directory of your JRE ,when jar files list is added click "Finish". Hit apply and run your java file
1. Go to file which you want to run
2.Right click on file -> go to "Run as"- > Go to "Run Configurations"
3. on the right large box of Run configuration go to JRE tab and select alternate JRE and click on installed JRE, on the right side select add button -> select standard VM and in the JRE home select directory of your JRE ,when jar files list is added click "Finish". Hit apply and run your java file