代码之家  ›  专栏  ›  技术社区  ›  Arayan Singh

scala Eclipse没有打开并给出错误:org.Eclipse.e4.core.di.InjectionException:java.lang.NoClassDefFoundError[duplicate]

  •  1
  • Arayan Singh  · 技术社区  · 6 年前

    我已经在Mac上安装了Scala eclipse,但当我尝试启动时却没有打开。现在连日食也不开放了。 然后我检查日志文件中是否有此项,并从日志文件堆栈跟踪:

    !SESSION 2018-07-30 13:20:28.430 -----------------------------------------------
    eclipse.buildId=4.7.0-vfinal-2017-09-29T14:34:02Z-Typesafe
    java.version=9.0.4
    java.vendor=Oracle Corporation
    BootLoader constants: OS=macosx, ARCH=x86_64, WS=cocoa, NL=en_IN
    Framework arguments:  -keyring /Users/admin/.eclipse_keyring
    Command-line arguments:  -os macosx -ws cocoa -arch x86_64 -keyring /Users/admin/.eclipse_keyring
    
    !ENTRY org.eclipse.osgi 4 0 2018-07-30 13:20:41.005
    !MESSAGE Application error
    !STACK 1
    org.eclipse.e4.core.di.InjectionException: java.lang.NoClassDefFoundError: javax/annotation/PostConstruct
        at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:410)
        at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:318)
        at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:162)
        at org.eclipse.e4.ui.internal.workbench.swt.E4Application.createDefaultHeadlessContext(E4Application.java:491)
        at org.eclipse.e4.ui.internal.workbench.swt.E4Application.createDefaultContext(E4Application.java:505)
        at org.eclipse.e4.ui.internal.workbench.swt.E4Application.createE4Workbench(E4Application.java:204)
        at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:614)
        at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
        at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:594)
        at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)
        at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:151)
        at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
    Caused by: java.lang.NoClassDefFoundError: javax/annotation/PostConstruct
        at org.eclipse.e4.core.internal.di.InjectorImpl.inject(InjectorImpl.java:124)
        at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:399)
        ... 22 more
    Caused by: java.lang.ClassNotFoundException: javax.annotation.PostConstruct cannot be found by org.eclipse.e4.core.di_1.6.100.v20170421-1418
        at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:433)
        at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:395)
        at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:387)
        at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:150)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)
        ... 24 more
    
    !ENTRY org.eclipse.e4.ui.workbench 4 0 2018-07-30 13:20:41.013
    !MESSAGE FrameworkEvent ERROR
    !STACK 0
    java.lang.NoClassDefFoundError: javax/annotation/PreDestroy
        at org.eclipse.e4.core.internal.di.InjectorImpl.disposed(InjectorImpl.java:450)
        at org.eclipse.e4.core.internal.di.Requestor.disposed(Requestor.java:156)
        at org.eclipse.e4.core.internal.contexts.ContextObjectSupplier$ContextInjectionListener.update(ContextObjectSupplier.java:78)
        at org.eclipse.e4.core.internal.contexts.TrackableComputationExt.update(TrackableComputationExt.java:111)
        at org.eclipse.e4.core.internal.contexts.TrackableComputationExt.handleInvalid(TrackableComputationExt.java:74)
        at org.eclipse.e4.core.internal.contexts.EclipseContext.dispose(EclipseContext.java:178)
    
        at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:395)
        at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:387)
        at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:150)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)
        ... 21 more
    

    有人能帮我解决这个问题吗?

    1 回复  |  直到 6 年前
        1
  •  1
  •   Arayan Singh    6 年前

    您正在使用Java9,因此必须添加 --add-modules=ALL-SYSTEM 到eclipse.ini

    或者你可以 remove Java 9和使用Java 8。对我来说很好。