Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 264378

Summary: JDT loosing JRE Classpath entries like rt.jar
Product: [Eclipse Project] JDT Reporter: Francois Fernandes <f.fernandes>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: f.fernandes, Olivier_Thomann
Version: 3.4.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows Vista   
Whiteboard: stalebug

Description Francois Fernandes CLA 2009-02-10 11:27:03 EST
Sometimes my eclipse (and the eclipse of other colleages) is going wild and loosing it's association to a particular JRE/JDK. That means that for some reason, eclipse tries to recompile the projects and fails because it can't resolve classes like java.lang.Object.

When looking at the JRE System Library entry using the Package Explorer, it is impossible to expand the Entries like rt.jar, jce.jar, etc. When selecting one of those jars the following error is logged:
Java Model Exception: Java Model Status [C:\Program Files (x86)\Java\jdk1.5.0_16\jre\lib\rt.jar is not on its project's build path]
	at org.eclipse.jdt.internal.core.PackageFragmentRoot.getRawClasspathEntry(PackageFragmentRoot.java:553)
	at org.eclipse.jdt.internal.ui.actions.JarImportWizardAction.selectionChanged(JarImportWizardAction.java:89)
	at org.eclipse.jdt.internal.ui.actions.JarImportWizardAction.selectionChanged(JarImportWizardAction.java:107)
	at org.eclipse.jface.viewers.Viewer$2.run(Viewer.java:162)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
	at org.eclipse.core.runtime.Platform.run(Platform.java:880)
	at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:48)
	at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175)
	at org.eclipse.jface.viewers.Viewer.fireSelectionChanged(Viewer.java:160)
	at org.eclipse.jface.viewers.StructuredViewer.updateSelection(StructuredViewer.java:2062)
	at org.eclipse.jface.viewers.StructuredViewer.handleSelect(StructuredViewer.java:1138)
	at org.eclipse.jface.viewers.StructuredViewer$4.widgetSelected(StructuredViewer.java:1168)
	at org.eclipse.jface.util.OpenStrategy.fireSelectionEvent(OpenStrategy.java:227)
	at org.eclipse.jface.util.OpenStrategy.access$3(OpenStrategy.java:221)
	at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:388)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3823)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3422)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2382)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2346)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2198)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:493)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:288)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:488)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:193)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:386)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:549)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1236)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1212)


To get rid of this is difficult. Sometimes it is enough to clean all projects, refresh all and then rebuild them. Sometimes (as it is this time) it is enough to wait for a moment and retry to expand the e.g. rt.jar node. Most often I have to restart eclipse, do some clean-refresh-build sequences and then it will work just fine.
Comment 1 Francois Fernandes CLA 2009-02-10 11:30:24 EST
Sorry, I forgot to mention how to reproduce the problem:
Up until now I have not found any situation causing the problem. It happens very irregulary.
Comment 2 Olivier Thomann CLA 2010-01-05 10:33:32 EST
Do you have other bundles installed ?
Comment 3 Eclipse Genie CLA 2020-03-20 15:19:13 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.