| « Checking in a directory structure under Clearcase | Changing the title of an "Add or Remove Programs" entry » |
Error occurred during initialization of VM java/lang/NoClassDefFoundError: java/lang/Object
September 15th, 2009Got attacked by a virus which went straight through Firefox’s defences then straight through McAfee’s defences then destroyed half of my machine. It’s still not running right, but I think the virus is now gone.
The virus attacked my Java installation and destroyed the classpath. When I tried to run Eclipse it flashed the splash screen and disappeared. There did not appear to be any error message from Eclipse to give me a clue as to the problem so I had to run Eclipse from the command line to find out what was going on.
- Open a command prompt
- Change directory to the root of Eclipse’s installation e.g.
cd c:\java\eclipse - Call the Eclipse executable directly e.g.
eclipse.exe
Eclipse spat out the following error message:
Error occurred during initialization of VM
java/lang/NoClassDefFoundError: java/lang/Object
My normal java setup still appeared to be fine, it was just Eclipse that wasn’t working. So I tried running Eclipse from the command line, avoiding the eclipse.exe executable. I used the following command line to kick start the equinox package manager and launch Eclipse. In my example I’m using Eclipse 3.5 Galileo, but in your version of Eclipse the launcher version may be different.
java -jar plugins\org.eclipse.equinox.launcher_1.0.200.v20090520.jar
This worked and launched Eclipse, but it immediately started to have problems with Java heap space which in turn caused problems for Background Indexer Crash Recovery and Initializing SpringSource Bundle Repository index. I eventually had to kill it.
Next, I tried launching Eclipse with extra command line options found in eclipse.ini:
java -Dosgi.requiredJavaVersion=1.5 -Xms40m -Xmx512m -jar plugins\org.eclipse.equinox.launcher_1.0.200.v20090520.jar
It seemed to work, but then I got:
Error while logging event loop exception:
java.lang.OutOfMemoryError: PermGen space
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.defineClass(DefaultClassLoader.java:183)
at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClass(ClasspathManager.java:576)
at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findClassImpl(ClasspathManager.java:546)
at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClassImpl(ClasspathManager.java:477)
at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass_LockClassLoader(ClasspathManager.java:465)
at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:445)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:211)
at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:376)
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:452)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:405)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:393)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:105)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
at org.eclipse.jdt.internal.ui.refactoring.reorg.CopyToClipboardAction$CopyToClipboardEnablementPolicy.canCopyToClipboard(CopyToClipboardAction.java:333)
at org.eclipse.jdt.internal.ui.refactoring.reorg.CopyToClipboardAction$CopyToClipboardEnablementPolicy.canCopyAllToClipboard(CopyToClipboardAction.java:324)
at org.eclipse.jdt.internal.ui.refactoring.reorg.CopyToClipboardAction$CopyToClipboardEnablementPolicy.canEnable(CopyToClipboardAction.java:312)
at org.eclipse.jdt.internal.ui.refactoring.reorg.CopyToClipboardAction.canEnable(CopyToClipboardAction.java:134)
at org.eclipse.jdt.internal.ui.refactoring.reorg.CopyToClipboardAction.selectionChanged(CopyToClipboardAction.java:100)
at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchSelectionChanged(SelectionDispatchAction.java:262)
at org.eclipse.jdt.ui.actions.SelectionDispatchAction.selectionChanged(SelectionDispatchAction.java:257)
at org.eclipse.jface.viewers.Viewer$2.run(Viewer.java:162)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.runtime.Platform.run(Platform.java:888)
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:2132)
at org.eclipse.jface.viewers.StructuredViewer.handleSelect(StructuredViewer.java:1160)
at org.eclipse.jface.viewers.StructuredViewer$4.widgetSelected(StructuredViewer.java:1190)
Logging exception:
java.lang.OutOfMemoryError: PermGen space
java.lang.OutOfMemoryError: PermGen space
java.lang.OutOfMemoryError: PermGen space
I tried increasing the memory allocations with:
java -Dosgi.requiredJavaVersion=1.5 -Xms40m -Xmx700m -jar plugins\org.eclipse.equinox.launcher_1.0.200.v20090520.jar
but it just delayed the problem.
The next stage was to remove Java from my system. The current installations were corrupted to the point that I couldn’t use the Add or Remove Programs to uninstall them. I used regedit to search the registry for any entries that contained references to Java/JDK/JRE and deleted them. To end the clean up I deleted all the installation files from disk.
Finally, I installed the JDK. I placed the JDK in c:\Java\Java\jdk1.6.0_16 and let the installer choose the location for the JRE.
Re-ran the Eclipse’s shortcut and all was well.