Sometimes when using eclipse it loses references to the JRE.
i.e. It cannot find classes like Object or Arraylist.
Some projects report a problem while others don’t and they both use the same JRE.
I have found that if you switch the installed JRE to another and then back again to the one you want to use, it will then work again
Is there a better way to stop it doing this?
EDIT: Reloading Eclipse doesn’t solve the problem
I may have a resolution for this. Eclipse was losing the JRE references on many of my Java projects almost daily, and restarting or starting with -clean wasn’t helping. I realised that it is clearly a classloader issue of some kind, so what I did was to open the ‘.classpath’ file of each project in the editor and manually move the JRE reference classpathentry line to be the first entry in the file, in the hope that it would load the JRE before any other classes which might be affecting it’s ability to load successfully.
Since doing this, the problem has not reoccurred.
I think the files starting with a ‘.’ are hidden by filter in the package explorer on a default eclipse install, so you may need to disable the ‘.* Resources’ filter to be able to open the ‘.classpath’ file.