5

当我在图形视图中打开我的 xml 文件时,它无法打开。我正在使用 Ubuntu 操作系统并在 eclipse indigo 中收到以下警告。

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

而我的Error Log显示如下。

  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)

这个怎么解决??

4

1 回答 1

4

有点晚了,但在过去我已经纠正了 X11 包的 ClassNoDefFound 告诉 Java 不要使用 X-Server 的此类错误:

export JAVA_OPTS="$JAVA_OPTS -Djava.awt.headless=true"
于 2018-12-03T18:23:20.033 回答