Question

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

Was it helpful?

Solution

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.

OTHER TIPS

The JRE reference in your project is stored using the name you give it in the Installed JREs preference page. Change the name and you break the reference. Just pick names you can keep reusing when switching JREs, or select the workspace default as the JRE for the project.

It happened to me, but after a reloading of Eclipse all continued working well!

Personally, I would chalk this up to bugs in eclipse. Check and make sure the source zip is installed with your JRE installation in eclipse. I know your pain. Eclipse is fantastic, but it still has some minor bugs.

I've had the same experience. Only in Ganymede. Always the same project. Deleting the project (but not the source of course) and re-creating the project fixes it temporarily. Seems to be happy for a week or two and then happens again.

Running the -clean flag when starting eclipse will remove temporary junk from the eclipse and make eclipse run better overall. I've had varying success with this, and it's a lot easier to implement than recreating the project or reinstalling eclipse. Give it a shot and see what happens.

Even though this is not for 3.4, it still applies. http://www.eclipsezone.com/eclipse/forums/t61566.html

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top