Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not initialize class sun.awt.X11.XToolkit

When I open my xml file in graphical view it can't open. I am using Ubuntu OS and getting following warning in eclipse indigo.

Could not initialize class sun.awt.X11.XToolkit
Exception details are logged in Window > Show View > Error Log

While my Error Log display follwing.

  Message :-  selectimage.xml: Could not initialize class sun.awt.X11.XToolkit

  Exception Stack Trace :

        java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11.XToolkit
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:186)
    at java.awt.Toolkit$2.run(Toolkit.java:849)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:841)
    at android.graphics.Paint_Delegate.updateFontObject(Paint_Delegate.java:1062)
    at android.graphics.Paint_Delegate.reset(Paint_Delegate.java:1039)
    at android.graphics.Paint_Delegate.<init>(Paint_Delegate.java:991)
    at android.graphics.Paint_Delegate.native_init(Paint_Delegate.java:614)
    at android.graphics.Paint.native_init(Paint.java)
    at android.graphics.Paint.<init>(Paint.java:194)
    at android.graphics.Paint.<init>(Paint.java:184)
    at android.view.ViewGroup.<init>(ViewGroup.java:277)
    at android.widget.LinearLayout.<init>(LinearLayout.java:114)
    at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:227)
    at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:318)
    at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:325)
    at com.android.ide.eclipse.adt.internal.editors.layout.gle2.RenderService.createRenderSession(RenderService.java:372)
    at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.renderWithBridge(GraphicalEditorPart.java:1361)
    at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.recomputeLayout(GraphicalEditorPart.java:1115)
    at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.activated(GraphicalEditorPart.java:941)
    at com.android.ide.eclipse.adt.internal.editors.layout.LayoutEditorDelegate.delegatePageChange(LayoutEditorDelegate.java:450)
    at com.android.ide.eclipse.adt.internal.editors.common.CommonXmlEditor.pageChange(CommonXmlEditor.java:358)
    at org.eclipse.ui.part.MultiPageEditorPart$2.widgetSelected(MultiPageEditorPart.java:290)
    at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:240)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1258)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1282)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1267)
    at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1061)
    at org.eclipse.swt.custom.CTabFolder.setSelection(CTabFolder.java:2746)
    at org.eclipse.swt.custom.CTabFolder.onMouse(CTabFolder.java:1433)
    at org.eclipse.swt.custom.CTabFolder$1.handleEvent(CTabFolder.java:257)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1258)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3588)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3209)
    at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2701)
    at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2665)
    at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2499)
    at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:679)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:668)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
    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:344)
    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:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:616)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1410)

How to solve this ??

like image 950
Hardik Joshi Avatar asked Oct 05 '22 07:10

Hardik Joshi


1 Answers

A little late but in the past I've corrected this type of errors ClassNoDefFound of X11 package telling Java not to use X-Server:

export JAVA_OPTS="$JAVA_OPTS -Djava.awt.headless=true"
like image 145
Hugo Hernandez Avatar answered Oct 10 '22 02:10

Hugo Hernandez